#include <stdio.h>
#include <pthread.h>
#include "psType.h"
Include dependency graph for psMemory.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
| struct | psMemBlock |
| Book-keeping data for storage allocator. More... | |
Defines | |
| #define | P_PS_MEMMAGIC (psU32)0xdeadbeef |
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 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 *file, 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 | |
| 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 | 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 | 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 | 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. | |
| int | psMemCheckLeaks (psMemId id0, psMemBlock ***array, FILE *fd, bool persistence) |
| Check for memory leaks. | |
| int | psMemCheckCorruption (FILE *output, bool abort_on_error) |
| Check for memory corruption. | |
| psReferenceCount | psMemGetRefCounter (const psPtr ptr) |
| Return reference counter. | |
| psPtr | psMemIncrRefCounter (const psPtr ptr) |
| Increment reference counter and return the pointer. | |
| psPtr | psMemDecrRefCounter (psPtr ptr) |
| Decrement reference counter and return the pointer. | |
| 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 | psMemGetLastId (void) |
| get the last memory ID used | |
| psMemId | psMemAllocCallbackSetID (psMemId id) |
| set p_psMemAllocID to specific id | |
| psMemId | psMemFreeCallbackSetID (psMemId id) |
| set p_psMemFreeID to id | |
| size_t | psMemStats (const bool print, size_t *allocated, size_t *persistent) |
| return statistics on memory usage persistent memory that's currently allocated | |
| int | psMemBlockPrint (FILE *output, const psMemBlock *memBlock) |
| print detailed information about a psMemBlock | |
1.5.1