As well-engineered as the .NET framework is, it's not perfect, and it doesn't always get memory management right. To write truly fantastic software, you need to understand how .NET memory management actually works. This book will take you from the very basics of memory management, all the way to how the OS handles its resources, and will help you write the best code you can.
Chris Farrell and Nick Harrison have both been working with the .NET framework since day one, and bring all their experience to bear in this book as they explain:
- How the .NET framework manages memory
- How to avoid writing unnecessarily resource–hungry code
- How to fix your applications' memory troubles
From the Introduction;
Tackling .NET memory management is very much like wrestling smoke; you can see the shape of the thing, you know it's got an underlying cause but, no matter how hard you try, it's always just slipping through your fingers. Over the past year, I've been very involved in several .NET memory management projects, and one of the few things I can say for sure is that there is a lot of conflicting (or at any rate, nebulous) information available online. And even that's pretty thin on the ground.
The .NET framework is a triumph of software engineering, a complex edifice of interlocking parts, so it's no wonder concrete information is a little hard to come by. There are a few gems out there, hidden away on MSDN, articles, and personal blogs, but structured, coherent information is a rare find. This struck us as, shall we say, an oversight. For all that the framework is very good at what it does, it is not infallible, and a deeper understanding of how it works can only improve the quality of the code written by those in the know.
We'll start with the foundations: an introduction to stacks and heaps, garbage collection, boxing and unboxing, statics and passing parameters. In the next two chapters, we'll clear away some misconceptions and lay out a detailed, map of generational garbage collection, partial garbage collection, weak references – everything you need to have a solid understanding of how garbage collection really works.
Chapters 4 and 5 will be practical, covering troubleshooting advice, tips, and tricks for avoiding encountering memory issues in the first place. We'll consider such conundrums as "how big is a string," fragmentation, yield, lambda, and the memory management quirks which are unique to WPF, ASP.NET, and ADO.NET, to name just a few.
To really give you the guided tour, we'll finish by covering some more advanced .NET topics: parallelism, heap implementation, and the Windows memory model.
It's not conclusive, by any means – there's much, much more that could be written about, but we only have one book to fill, not an entire shelf. Consider this, instead, to be your first solid stepping stone.
Some lite weekend reading...
Related Past Post XRef:
.Net Memory Management Explained - Red Gate Story Book Style...