Chapter Contents |
Previous |
Next |
hpextract |
SYNOPSIS | |
DESCRIPTION | |
RETURN VALUE | |
IMPLEMENTATION | |
EXAMPLE | |
RELATED FUNCTIONS | |
SEE ALSO |
SYNOPSIS |
#include <multheap.h> _heap_id hpextract(void);
DESCRIPTION |
hpextract
returns the ID
of the current (default) heap. This ID can be used to verify which heap is
about to be used for malloc
or free
.
RETURN VALUE |
hpextract
returns the ID
of the current (default) heap. If this ID is the same as _HEAP_STD
, then the default heap is the same as the standard heap.
This is always true at entry to the main function. The default heap can be
changed by calls to hppush
and hppop
.
IMPLEMENTATION |
For a program using more than one coprocess, it is possible that the default heap can be different for each coprocess. Whenever a coprocess switch occurs, if the new coprocess is using a different heap than the old coprocess, then the default heap is switched as well.
EXAMPLE |
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <multheap.h> main() { _heap_id id1; ... id1 = hpextract(); // if the default heap has been changed if (id != _HEAP_STD) { hppush(_HEAP_STD); // switch to standard heap } link = calloc(1, 20); if (id != _HEAP_STD) { hppop; // restore current heap } ... > }
RELATED FUNCTIONS |
hpalloc
, hpcalloc
, hpfree
,
hpdestroy
, hppush
SEE ALSO |
"Memory Allocation Functions" in Chapter 2, "Function Categories" of the SAS/C Library Reference, Volume 1.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2004 by SAS Institute Inc., Cary, NC, USA. All rights reserved.