This chapter presents various aspects of memory management and memory access, Although the runtime takes much of the responsibility for memory management away from the programmer, it is useful to understand how memory management works and important to know how to work .with unmanaged resources efficiently.
A good understanding of memory management and knowledge of the pointer capabilities , provided by C# will better enable you to integrate C# code with legacy code and perform efficient memory manipulation in performance-critical systems.
Specifically;.this chapter discusses:
- How the runtime allocates space on the stack and the heap.
- How garbage collection works.
- How to use destructors and the System. IDisposable interface to ensure unmanaged resources are released correctly.
- The syntax for using pointers in C#.
- How to use pointers to implement high-performance stack-based arrays.