Overview
Microsoft Windows has been through a great number of changes over the years. In the late 1980s, system memory was at a huge premium, and it was all you could do to squeeze the bytes out of the RAM installed on your machine. With Windows running at 32 bits, the story has changed dramatically. In 16-bit Windows, you had to perform an immense amount of housekeeping by calling the Win16 memory management functions (such as GlobalAlloc and GlobalLock). These functions were carried forward into Win32, but only for reasons of backward compatibility. Underneath, the original functions work very differently, and many new ones have been added.This chapter covers Win32 memory management theory, including the virtual memory and the fundamental heap management functions. The chapter also covers how the C++ new and delete operators connect with the underlying heap functions. Finally, the chapter covers how to use the memory-mapped file functions, finishing with some practical tips on managing dynamic memory. For more in-depth information about Windows memory management, you'll want to look at Jeffrey Richter's Programming Applications for Microsoft Windows, Fourth Edition (Microsoft Press, 1999), which covers Windows 2000.