Next steps
I hope you remember most of the things we discussed, but just in case you forgot, we will go through the most essential points again.
First, we discussed how the CLR and GC work together to remove the pain of memory management. We looked into how the GC works, what the generations mean, and what the LOH does.
We also talked about finalizers and why they can kill your performance. We also saw that they have a place when you use the IDisposable
pattern (so long as you don’t forget to call GC.SupressFinalize(this)
to remove the finalizer if it is unnecessary).
Then, I shared a couple of techniques you can use to optimize your memory usage if you need the least amount of memory usage in your system.
I want to reiterate a crucial point about memory optimization. In 99 of 100 cases, the CLR and the GC do an outstanding job. Trying to outsmart them doesn’t always result in better systems. The team behind these tools is good at what they do, and they use...