Memory Management Under the Hood
One of the declared advantages of C# programming is that the programmer doesn’t need to worry about detailed memory management; in particular the garbage collector deals with all memory cleanup on your behalf. The result is that you can
Memory Management Under the Hood
One of the declared advantages of C# programming is that the programmer doesn’t need to worry about detailed memory management; in particular the garbage collector deals with all memory cleanup on your behalf. The result is that you can gel something close to the efficiency of languages like C++, without the complexity of having to handle memory Management yourself in the way that you need to do in C#. However, although you don’t have to manage the memory manually. if you are to write efficient code, it still pays to understand what is going on behind the scenes. In this section we will take a look at what happens in the computer’s memory when you allocate variables. I should stress that the precise details of much of the content of this section are undocumented. You should interpret this section as a rather simplified guide to the general principles that are going on, rather than as a statement of exact implementation.