Heap

A heap tracks a group of allocations that are freed as a unit.

This allows you to avoid complex patterns of allocating and deallocating memory when you use the WWSAPI.

There is a heap associated with every message. As a message is being sent, or as a message is being received, the heap of the message is used for any allocations relating to that particular message. After a message is sent or received, the heap is reset (which cleans up any allocations related to the particular message).

Heaps can also be used to store message data separately from the lifetime of a message. Many of the API's allow specification of the heap to use when reading data give explicit control over the lifetime of any data read.

Allocations from a heap are guaranteed to be aligned on at least an 8 byte boundary.

Zero byte allocations will return a non-NULL pointer.

In Windows 7, if PageHeap is enabled, a heap returned from HeapCreate is used to manage the memory. In this case, WsAlloc maps directly to HeapAlloc and WsResetHeap maps to HeapDestroy.

The following enumeration is used with the heap:

The following functions are used with the heap:

The following handle is used with the heap:

The following structures are used with the heap: