### Manage Memory with Multiple Heaps

IBM C and C++ Compilers gives you the option of creating and using your own pools of memory, called heaps. You can use your own heaps in place of or in addition to the default IBM C and C++ Compilers run-time heap to improve the performance of your program.

Using your own heaps is entirely optional, and your applications will work perfectly well using the default memory management provided (and used by) the IBM C and C++ Compilers run-time library.

You can have any number of heaps of any type. The only limit is the space available on your operating system.

Tiled heaps are only available on OS/2.

IBM C and C++ Compilers provides heap-specific versions of the memory management functions, such as malloc, and a number of new functions that you can use to create and manage your own heaps of memory. Debug versions of all the memory management functions are available, including the heap-specific ones.

You can also use debug versions with tiled memory and shared memory, which was not previously possible.

Because multiple heaps and the functions that support them are extensions to the ANSI language standard, the language level must be set to "extended", using one of the following methods:

- The /Se compiler option (set by default)
- The #pragma langlvl(extended) directive.

Types of Memory
Advantages of Using Multiple Heaps

Create a Fixed-Size Heap
Create an Expandable Heap
Improve Memory Management
Debug Heap Use

Differentiating between Memory Management Functions
C Library Functions: Transparent Memory Pooling