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

The OS/2 API Project

DosSubFreeMem

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

Syntax

rc = DosSubFreeMem( pOffset, pBlockOffset, ulSize );

Parameters

PVOID pOffset (input)
The Offset of the memory pool that contains the block that should be freed.

PVOID pBlockOffset (input)
The offset of the memory block to be freed. It's important that this is equal to an offset returned by a previous allocation using DosSubAllocMem.

ULONG ulSize (input)
The size in bytes of the memory block that is to be freed.

Returns

APIRET rc
The following values can be returned
0NO_ERROR
87ERROR_INVALID_PARAMETER
312ERROR_DOSSUB_OVERLAP
532ERROR_DOSSUB_CORRUPTED

Include Info

#define INCL_DOSMEMMGR
#include <bsememf.h>
#include <os2.h>

Usage Explanation

DosSubFreeMem is used to free a memory block that was allocated with DosSubAllocMem. Size is the size in bytes of the memory block to be freed. It is supposed to be a multiple of 8 bytes, and if not it is rounded up. The maximum value for Size is the size of the memory pool, allocated with DosSubSetMem, minus 64 bytes.

Relevant Structures

Gotchas

The maximum value for Size is the size of the memory pool, allocated with DosSubSetMem, minus 64 bytes.

Sample Code

#define INCL_DOSMEMMGR #include <os2.h> #include <bsememf.h> PVOID Offset; PVOID BlockOffset; ULONG Size; APIRET rc; size = 128; rc = DosSubFreeMem( Offset, BlockOffset, Size); if (rc != 0) { /* We have an error we must take care of. */ }

See Also

DosSubAllocMem, DosSubSetMem, DosSubUnsetMem

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

DosSubFreeMem