DosSubUnsetMem terminates the use of a heap within a memory object. All calls to DosSubSetMem must eventually be followed by a call to DosSubUnsetMem. This enables the suballocation function to free the resources that it uses to manage the heap.

The application must call DosSubUnsetMem before it frees the memory object that contains this heap (with DosFreeMem).

The following code fragment shows the termination of a heap. Assume that the address of the heap was placed into Offset already.

    #define  INCL_DOSMEMMGR   /* Memory Manager values */
    #include <os2.h>
    #include <stdio.h>

    PVOID   pOffset;    /* Offset of the heap whose use is being terminated */
    APIRET  ulrc;       /* Return code                                      */

    ulrc = DosSubUnsetMem(pOffset);

    if (ulrc != 0) {
        printf("DosSubUnsetMem error: return code = %ld",
               ulrc);
        return;
    }


[Back] [Next]