Heap Allocation

You can use the system heap to allocate memory objects of any size, rather than allocating in units of pages.

To allocate a memory object on the heap, use the _HeapAllocate service. You can change the size of the memory object using the _HeapReAllocate service and free it using the _HeapFree service. To determine the size of a memory object, use the _HeapGetSize service.

There are three system heaps: the locked heap, the swappable heap, and the init heap. The init heap is discarded at the end of Init_Complete. The locked and swappable heaps remain available as long as the system is running. Memory allocated into the swappable heap is swappable; your VxD must be careful not to access it at a time when paging is not allowed.

The system provides no memory protection for memory objects on the heap. It also does not compact the heap. Therefore, virtual devices should avoid using the heap in such a way as to severely fragment it.

See also _HeapAllocate, _HeapFree, _HeapGetSize, _HeapReAllocate