Collaboration diagram for Memory Callbacks:
|
Typedefs | |
| typedef psMemId(* | psMemAllocCallback )(const psMemBlock *ptr) |
| prototype of a basic callback used by memory functions | |
| typedef psMemId(* | psMemFreeCallback )(const psMemBlock *ptr) |
| prototype of memory free callback used by memory functions | |
| typedef void(* | psMemProblemCallback )(psMemBlock *ptr, const char *filename, unsigned int lineno) |
| prototype of a callback used in error conditions | |
| typedef psPtr(* | psMemExhaustedCallback )(size_t size) |
| prototype of a callback function used when memory runs out | |
Functions | |
| psMemProblemCallback | psMemProblemCallbackSet (psMemProblemCallback func) |
| Set callback for problems. | |
| psMemExhaustedCallback | psMemExhaustedCallbackSet (psMemExhaustedCallback func) |
| Set callback for out-of-memory. | |
| psMemAllocCallback | psMemAllocCallbackSet (psMemAllocCallback func) |
| Set call back for when a particular memory block is allocated. | |
| psMemFreeCallback | psMemFreeCallbackSet (psMemFreeCallback func) |
| Set call back for when a particular memory block is freed. | |
| psMemId | psMemGetId (void) |
| get next memory ID | |
| psMemId | psMemAllocCallbackSetID (psMemId id) |
| set p_psMemAllocID to specific id | |
| psMemId | psMemFreeCallbackSetID (psMemId id) |
| set p_psMemFreeID to id | |
|
|
prototype of a basic callback used by memory functions
Definition at line 86 of file psMemory.h. |
|
|
prototype of a callback function used when memory runs out
Definition at line 120 of file psMemory.h. |
|
|
prototype of memory free callback used by memory functions
Definition at line 95 of file psMemory.h. |
|
|
prototype of a callback used in error conditions This callback should not try to call psAlloc or psFree.
Definition at line 106 of file psMemory.h. |
|
|
Set call back for when a particular memory block is allocated. A private variable, p_psMemAllocID, can be used to trace the allocation and freeing of specific memory blocks. If p_psMemAllocID is set and a memory block with that ID is allocated, psMemAllocCallback is called just before memory is returned to the calling function.
|
|
|
set p_psMemAllocID to specific id A private variable, p_psMemAllocID, can be used to trace the allocation and freeing of specific memory blocks. If p_psMemAllocID is set and a memory block with that ID is allocated, psMemAllocCallback is called just before memory is returned to the calling function.
|
|
|
Set callback for out-of-memory. If not enough memory is available to satisfy a request by psAlloc or psRealloc, these functions attempt to find an alternative solution by calling the psMemExhaustedCallback, a function which may be set by the programmer in appropriate circumstances, rather than immediately fail. The typical use of such a feature may be when a program needs a large chunk of memory to do an operation, but the exact size is not critical. This feature gives the programmer the opportunity to make a smaller request and try again, limiting the size of the operating buffer.
|
|
|
Set call back for when a particular memory block is freed. A private variable, p_psMemFreeID, can be used to trace the freeing of specific memory blocks. If p_psMemFreeID is set and the memory block with the ID is about to be freed, the psMemFreeCallback callback is called just before the memory block is freed.
|
|
|
set p_psMemFreeID to id A private variable, p_psMemFreeID, can be used to trace the freeing of specific memory blocks. If p_psMemFreeID is set and the memory block with the ID is about to be freed, the psMemFreeCallback callback is called just before the memory block is freed.
|
|
|
get next memory ID
|
|
|
Set callback for problems. At various occasions, the memory manager can check the state of the memory stack. If any of these checks discover that the memory stack is corrupted, the psMemProblemCallback is called.
|
1.4.2