gtpc2m62C/C++ Language Support User's Guide

rsysc-Release Storage from the System Heap

This function releases storage from the system heap, and returns the 4-KB frames to the pool of available frames.

Format

#include <sysapi.h>
int rsysc(void *address, int frames, char *token);

address
This argument specifies the address of the storage to be released from the system heap.

frames
This argument specifies the number of 4-KB frames to be released.

token
This argument specifies a pointer to the string that was specified when the storage was acquired.

Normal Return

RSYSC_OK indicates that the storage is released successfully.

Error Return

If the function was passed an incorrect address, number of frames, or token, error code RSYSC_ERROR is returned and no storage is released.

Programming Considerations

Examples

The following example allocates and releases 12 KB of system heap storage.

#include <sysapi.h>
#include <stdio.h>

·
·
·
{ /******************************************************************/ /* Allocate 12 KB of storage for a table used by many different */ /* ECBs. */ /******************************************************************/ int frames, rc; char * token = "TABLE40 "; struct table { char *name; int code; } *tbl_ptr; frames = 3; tbl_ptr = gsysc(frames, token); if (tbl_ptr == 0) { serrc_op(SERRC_EXIT, 0x1111, "Error allocating table.", NULL); }
·
·
·
rc = rsysc((void *)tbl_ptr, frames, token); if (rc == RSYSC_ERROR) { serrc_op(SERRC_EXIT, 0x2222, "Error releasing storage.", NULL); } }

Related Information

gsysc-Get Storage from the System Heap.