Chapter 7: Memory Management and Pointers


Overview

This chapter looks at 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.

If you have a good understanding of memory management and knowledge of the pointer capabilities provided by C#, you are also better positioned 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




Professional C# 2005
Pro Visual C++ 2005 for C# Developers
ISBN: 1590596080
EAN: 2147483647
Year: 2005
Pages: 351
Authors: Dean C. Wills

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net