Jump to content

DosSubUnsetMem: Difference between revisions

From EDM2
Ak120 (talk | contribs)
No edit summary
Ak120 (talk | contribs)
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
DosSubUnsetMem is used to terminate a memory pool.
=== Syntax ===
=== Syntax ===
  rc = DosSubUnsetMem( ''pOffset'' );
  rc = DosSubUnsetMem( ''pOffset'' );


=== Parameters ===
=== Parameters ===
PVOID ''pOffset'' (input)
;PVOID ''pOffset'' (input):This is the offset of the memory pool which we no longer need.
 
This is the offset of the memory pool which we no longer need.
   
   
=== Returns ===
=== Returns ===
  APIRET rc
  APIRET rc
The following values can be returned:
The following values can be returned:
{|class="wikitable"
*0 NO_ERROR
|0||NO_ERROR
*532 ERROR_DOSSUB_CORRUPTED
|-
|532||ERROR_DOSSUB_CORRUPTED
|}
 
=== Include Info ===
#define INCL_DOSMEMMGR
#include <os2.h>
#include <bsememf.h>


=== Usage Explanation ===
=== Usage Explanation ===
DosSubUnsetMem is used to terminate a memory pool. It is used to allow the suballocation  
It is used to allow the suballocation function to release resources it used to manage the suballocation of the memory block. All calls to [[DosSubSetMem]] should be followed by a call to DosSubUnsetMem. All calls to DosSubUnsetMem must occur before the memory block is freed.
function to release resources it used to manage the suballocation of the memory block. All  
calls to [[DosSubSetMem]] should be followed by a call to DosSubUnsetMem. All calls to DosSubUnsetMem must occur before the memory block is freed.
   
   
=== Sample Code ===
=== Sample Code ===
<pre>
<pre>
#define INCL_DOSMEMMGR
#define INCL_DOSMEMMGR
#include  
#include <os2.h>
#include  
#include <bsememf.h>


PVOID Offset;    /* Offset of the memory pool which we will terminate. */
PVOID Offset;    /* Offset of the memory pool which we will terminate. */
Line 48: Line 37:


=== See Also ===
=== See Also ===
[[OS2 API:CPI:DosSubAllocMem|CPI:DosSubAllocMem]],
*[[DosSubAllocMem]]
[[OS2 API:CPI:DosSubFreeMem|CPI:DosSubFreeMem]],
*[[DosSubFreeMem]]
[[OS2 API:CPI:DosSubSetMem|CPI:DosSubSetMem]]  
*[[DosSubSetMem]]


[[Category:The OS/2 API Project]]
[[Category:Dos]]

Latest revision as of 16:19, 9 October 2018

DosSubUnsetMem is used to terminate a memory pool.

Syntax

rc = DosSubUnsetMem( pOffset );

Parameters

PVOID pOffset (input)
This is the offset of the memory pool which we no longer need.

Returns

APIRET rc

The following values can be returned:

  • 0 NO_ERROR
  • 532 ERROR_DOSSUB_CORRUPTED

Usage Explanation

It is used to allow the suballocation function to release resources it used to manage the suballocation of the memory block. All calls to DosSubSetMem should be followed by a call to DosSubUnsetMem. All calls to DosSubUnsetMem must occur before the memory block is freed.

Sample Code

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

PVOID Offset;     /* Offset of the memory pool which we will terminate. */
APIRET rc;        /* Just to take care of the return code.              */

/* Offset should be set to the offset of the memory pool which we are   */
/* about to terminate.                                                  */

rc = DosSubUnsetMem( Offset);

if (rc != 0)
{
   /* We have an error we must take care of. */
}

See Also