DosFreeMem releases a previously allocated private or shared memory object from the virtual-address space of the subject process. The released pages are given an access protection of no access.
Freeing a shared memory object decrements the reference count for the associated object. If the resulting count is zero (that is, no other references to the shared memory object exist throughout the system), then the object is deleted. The deletion of the shared memory object releases the backing storage for the committed pages within the object.
Note: DosAllocMem and DosAllocSharedMem both allocate a block of memory of the size requested rounded to the nearest page. On OS/2 Warp, the system allocates a 64K object without attributes on every allocation.
For example, for a DosAllocMem call with a size of 1, the following occurs:
Note:
When you allocate a memory object with the PAG_EXECUTE attribute, it is implied that this memory object also has the PAG_READ attribute. However, when querying the attributes of a memory object, you will get the following results: