Creating Your Own Heaps
You should consider creating your own heap for memory allocation if you want to do either of the following:
Make lots of memory allocations that will all be deleted at the same time
Make lots of memory allocations of the same size
As described earlier, the default heap cannot be deleted, and so fragmentation can cause memory problems if the process executes over a long period of time. By using your own heaps, you can delete the heap periodically and therefore effectively remove fragmentation and memory wastage.
A new heap can be created using the function HeapCreate. This function is passed a serialization option, the initial size for the heap, and the maximum size of heap. All heaps are serialized and the initial size ...