Chapter Contents

Previous

Next
hppush

hppush



Save and Change Current Heap


SYNOPSIS
DESCRIPTION
RETURN VALUE
ERRORS
IMPLEMENTATION
EXAMPLE
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

#include <multheap.h>
int *hppush(_heap_id heapid, int autopop);


DESCRIPTION

hppush changes the default heap to the heap identified by heapid. If autopop = HPPUSH_AUTOPOP, when the function that calls hppush returns, the heap will be reset to its state on entry to the calling function.


RETURN VALUE

hppush returns 0 if the function succeeds, -1 if the heapid was invalid, or -2 if insufficient memory was available to complete the operation.


ERRORS

User ABEND 1205 or 1206 may occur if memory management data areas are overlaid.


IMPLEMENTATION

Using hppush to change the default heap allows code that calls malloc, calloc, and so forth to make use of a different heap than that which is provided as the standard heap. The autopop specification HPPUSH_AUTOPOP may be useful in specifying a default heap to be used only for the duration of a specific function and its descendants. It is especially useful if the function has many different return statements, or if it may be terminated by longjmp from a signal handler.


EXAMPLE

See the example for hpextract.


RELATED FUNCTIONS

hppop, hpcreate


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.