Collaboration diagram for MemoryManagement:
|
Files | |
| file | psMemory.h |
| Contains the definitions for the memory management system. | |
Modules | |
| Memory Callbacks | |
| Routines dealing with the creating and setting of memory management callback functions. | |
| Memory Tracing | |
| Routines dealing with memory tracing and corruption checking. | |
| Reference Count | |
| Routines dealing with the reference counting of allocated buffers. | |
Data Structures | |
| struct | psMemBlock |
| Book-keeping data for storage allocator. More... | |
Typedefs | |
| typedef unsigned long | psMemId |
| typedef for memory identification numbers. Guaranteed to be some variety of integer. | |
| typedef unsigned long | psReferenceCount |
| typedef for a memory block's reference count. Guaranteed to be some variety of integer. | |
| typedef void(* | psFreeFunc )(void *ptr) |
| typedef for deallocator. | |
| typedef psMemBlock | psMemBlock |
| Book-keeping data for storage allocator. | |
Functions | |
| psPtr | psAlloc (size_t size) |
| Memory allocation. | |
| void | psMemSetDeallocator (psPtr ptr, psFreeFunc freeFunc) |
| Set the deallocator routine. | |
| psFreeFunc | psMemGetDeallocator (const psPtr ptr) |
| Get the deallocator routine. | |
| bool | psMemCheckType (psDataType type, psPtr ptr) |
| Checks the deallocator to see if the pointer matches the desired datatype. | |
| bool | psMemSetThreadSafety (bool safe) |
| Activate or Deactivate thread safety and mutex locking in the memory management. | |
| bool | psMemGetThreadSafety (void) |
| Get the current state of thread safety and mutex locking in the memory management. | |
| void | p_psMemSetPersistent (psPtr ptr, bool value) |
| Set the memory as persistent so that it is ignored when detecting memory leaks. | |
| bool | p_psMemAllocatePersistent (bool is_persistent) |
| Set whether allocated memory is persistent Should all memory allocated be persistent? | |
| bool | p_psMemGetPersistent (psPtr ptr) |
| Get the memory's persistent flag. | |
| psPtr | psRealloc (psPtr ptr, size_t size) |
| Memory re-allocation. | |
| void | psFree (psPtr ptr) |
| Free memory. | |
|
|
typedef for deallocator.
Definition at line 57 of file psMemory.h. |
|
|
Book-keeping data for storage allocator. N.b. sizeof(psMemBlock) must be chosen such that if ptr is a pointer returned by malloc, then ((char *)ptr + sizeof(psMemBlock)) is properly aligned for all storage types. |
|
|
typedef for memory identification numbers. Guaranteed to be some variety of integer.
Definition at line 51 of file psMemory.h. |
|
|
typedef for a memory block's reference count. Guaranteed to be some variety of integer.
Definition at line 54 of file psMemory.h. |
|
|
Set whether allocated memory is persistent Should all memory allocated be persistent? Set whether allocated memory is persistent. The defeault is false.
|
|
|
Get the memory's persistent flag. Checks if a memory block has been marked as persistent by p_psMemSetPresistent. Memory marked as persistent is excluded from memory leak checks.
|
|
||||||||||||
|
Set the memory as persistent so that it is ignored when detecting memory leaks. Used to mark a memory block as persistent data within the library, i.e., non user-level data used to hold psLib's state or cache data. Such examples of this class of memory is psTrace's trace-levels and dynamic error codes. Memory marked as persistent is excluded from memory leak checks.
|
|
|
Memory allocation. This operates much like malloc(), but is guaranteed to return a non-NULL value.
|
|
|
Free memory. This operates much like free().
|
|
||||||||||||
|
Checks the deallocator to see if the pointer matches the desired datatype.
|
|
|
Get the deallocator routine. This function returns the deallocator for a memory block. A deallocator routine can optionally be assigned to a memory block to ensure that associated memory blocks also get freed, e.g., memory buffers referenced within a struct.
|
|
|
Get the current state of thread safety and mutex locking in the memory management. psMemGetThreadSafety shall return the current state of thread safety in the memory management system.
|
|
||||||||||||
|
Set the deallocator routine. A deallocator routine can optionally be assigned to a memory block to ensure that associated memory blocks also get freed, e.g., memory buffers referenced within a struct.
|
|
|
Activate or Deactivate thread safety and mutex locking in the memory management. psMemThreadSafety shall turn on thread safety in the memory management functions if safe is true, and deactivate all mutex locking in the memory management functions if safe is false. The function shall return the previous value of the thread safety. Note that the default behaviour of the library shall be for the locking to be performed.
|
|
||||||||||||
|
Memory re-allocation. This operates much like realloc(), but is guaranteed to return a non-NULL value.
|
1.4.4