[ Home | Alpha index | Topic index | Tutorials | Download | Feedback ]

The OS/2 API Project

DosFreeMem

[ Syntax | Params | Returns | Include | Usage | Structs | Gotchas | Code | Also ]

Syntax

rc = DosFreeMem( pBaseAddress );

Parameters

PVOID pBaseAddress (input)
This variable should contain the base address of the private/shared memory object, whose reference is to be freed.

Returns

APIRET rc
The following values can be returned
0NO_ERROR
5ERROR_ACCESS_DENIED
95ERROR_INTERRUPT
487ERROR_INVALID_ADDRESS

Include Info

#define INCL_DOSMEMMGR
#include <os2.h>

Usage Explanation

DosFreeMem will free the private or shared memory block from the process. The released page will automaticly get an access protection of 'no access'. If no other references to this memory block exists throughout the system, it will be discarded, and can later be reused.

Relevant Structures

Gotchas

Sample Code

#define INCL_DOSMEMMGR #include <os2.h> PVOID BaseAddress; /* Pointer to the allocated memory block */ /* We allocate a memory block, and put the base address of it in BaseAddress */ rc = DosFreeMem( BaseAddress); if (rc != 0) { /* We got an error to take care of. */ }

See Also

DosAllocSharedMem, DosAllocMem

Author

Stefan Mars - mars@lysator.liu.se

Additions

Last modified March 16/1996
Please send all errors, comments, and suggestions to: timur@vnet.ibm.com

The OS/2 API Project

DosFreeMem