The first method is allocating more memory than the second method. But i dont see any memory leak. The advice is sound, but the termonology is wrong. A memeory leak is where the memonry is NOT released (even after the GC have done its thing). Calling this a memeory leak causes confusion, espicially for new developers without a formal education and people still learning the field. Other than that, it is a good introduction video about string manipulation and how to use dotnet counters to identify sub-optimal code, which allocates more memeory than expected.
After scrolling through 20s of video, I was confused why he says memory leak and then calling GC endpoint and it releases memory. This is totally wrong terminology. It's not memory leak, it's bad code to complete specific task!
Yes, it is just lots of memory allocation, not memory leak, you still keep references to those strings. Memory leak would have been exiting and not closing an open database connection, or an HTTP connection, causing memory leak, and in case of a HTTP connection, an eventual socket exhaustion too. Still, the leak example notwithstanding, I think this video is excellent, and very useful; it covers everything one would realistically ever really need to know about garbage collection. And it is all very well, concisely explained.
Thank you for sharing! Well explained.
The first method is allocating more memory than the second method. But i dont see any memory leak.
The advice is sound, but the termonology is wrong.
A memeory leak is where the memonry is NOT released (even after the GC have done its thing).
Calling this a memeory leak causes confusion, espicially for new developers without a formal education and people still learning the field.
Other than that, it is a good introduction video about string manipulation and how to use dotnet counters to identify sub-optimal code, which allocates more memeory than expected.
After scrolling through 20s of video, I was confused why he says memory leak and then calling GC endpoint and it releases memory. This is totally wrong terminology. It's not memory leak, it's bad code to complete specific task!
Yes, it is just lots of memory allocation, not memory leak, you still keep references to those strings. Memory leak would have been exiting and not closing an open database connection, or an HTTP connection, causing memory leak, and in case of a HTTP connection, an eventual socket exhaustion too. Still, the leak example notwithstanding, I think this video is excellent, and very useful; it covers everything one would realistically ever really need to know about garbage collection. And it is all very well, concisely explained.
Absolutely - I see not a single sign of memory leakage.