This is a "quick and dirty" memory manager for normal alloc and 
freeunder MS-Windows. It can be used for linked lists with
constructs like struct->next.

Functions are (memman.c and memman.h):

int CreateHeap (long lSize, int nMaxHandles)
         creates a static heap in global memory. May be larger
         than 64 KB. Works only in protected mode. Only one heap 
         is allowed. A list for the heapnodes and the free nodes
         is allocated in global memory. The block with the heap 
         only holds net data. All global blocks are locked during
         runtime (does't matters so much in protected mode). Each 
         object must be less than 64KB. The heap and the lists 
         can't grow at runtime (the pointers would get invalid).
         That's why you have to estimate the size of the heap and
         the number of possible objects at creation of the heap.

far void *AllocMem (long lSize)
         returns a far pointer to allocated memory

int FreeMem (far void*)
         frees previously allocated memory

far void *ReAllocMem (far void *, long lNewSize)
         changes size of previously allocated piece of memory, if 
         lNewSize == 0 frees memory. Returned pointer may change.

int DestroyHeap ()
         frees the heap in global memory


There is a small application (MEM.EXE) to test these functions. If you find errors or want to improve the manager leave me a message on COMPUSERVE (ID: 100015,1534).