Guardian Programmer's Guide

Table Of Contents
Managing Memory
Guardian Programmer’s Guide 421922-014
17 - 48
Getting Information About a Memory Pool
additional space exists in the segment and is not occupied by other data. If the pool is
defined at the end of its segment (that is, there is no room to resize the pool), the
RESIZESEGMENT procedure can be used to extend the segment before calling
POOL_RESIZE_.
Getting Information About a Memory Pool
Use the POOL_GETINFO_ procedure to return information about a memory pool.
Information returned includes error information, pool size, and the number of bytes
currently allocated.
To get information about a memory pool, you must supply the POOL_GETINFO_
procedure with the starting address of the pool. You must also supply output
parameters for the values to be returned.
The following example returns the size of the pool pointed to by POOL^START. (The
size returned will be less than the size specified in the POOL_DEFINE_ procedure
because of the space occupied by the pool header.)
ERROR := POOL_GETINFO_(POOL^START,
!error^detail!,
POOL^SIZE);
See the Guardian Procedure Calls Reference Manual for details on other information
returned by POOL_GETINFO_.
Debugging a Memory Pool
The POOL_CHECK_ procedure returns information to help diagnose errors that occur
when using memory pools. You typically call POOL_CHECK_ after an error has been
returned by one of the other pool-management procedures. Specific information
returned by POOL_CHECK_ depends on the particular error. Returned information
can include:
Address of the block of space within the pool where the error occurred.
Address of the valid block closest to the block where the error occurred.
Size of the last valid block allocated before the error occurred.
See the Guardian Procedure Calls Reference Manual for details on the information
returned by POOL_CHECK_.