Changeset 344 for trunk/archive/pslib/include/psMemory.h
- Timestamp:
- Mar 31, 2004, 5:01:04 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/archive/pslib/include/psMemory.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/pslib/include/psMemory.h
r326 r344 16 16 */ 17 17 typedef struct { 18 const void *magic0; // !< initialised to p_psMEMMAGIC19 const unsigned long id; // !< a unique ID for this allocation20 const char *file; // !< set from __FILE__ in e.g. p_psAlloc21 const int lineno; // !< set from __LINE__ in e.g. p_psAlloc22 int refCounter; // !< how many times pointer is referenced23 const void *magic; // !< initialised to p_psMEMMAGIC18 const void *magic0; ///< initialised to p_psMEMMAGIC 19 const unsigned long id; ///< a unique ID for this allocation 20 const char *file; ///< set from __FILE__ in e.g. p_psAlloc 21 const int lineno; ///< set from __LINE__ in e.g. p_psAlloc 22 int refCounter; ///< how many times pointer is referenced 23 const void *magic; ///< initialised to p_psMEMMAGIC 24 24 } psMemBlock; 25 25 … … 39 39 40 40 /// Memory allocation. Underlying private function called by macro psAlloc. 41 void *p_psAlloc(size_t size, // !< Size required42 const char *file, // !< File of call43 int lineno // !< Line number of call41 void *p_psAlloc(size_t size, ///< Size required 42 const char *file, ///< File of call 43 int lineno ///< Line number of call 44 44 ); 45 45 46 46 /// Memory re-allocation. Underlying private function called by macro psRealloc. 47 void *p_psRealloc(void *ptr, // !< Pointer to re-allocate48 size_t size, // !< Size required49 const char *file, // !< File of call50 int lineno // !< Line number of call47 void *p_psRealloc(void *ptr, ///< Pointer to re-allocate 48 size_t size, ///< Size required 49 const char *file, ///< File of call 50 int lineno ///< Line number of call 51 51 ); 52 52 53 53 /// Free memory. Underlying private function called by macro psFree. 54 void p_psFree(void *ptr, // !< Pointer to free55 const char *file, // !< File of call56 int lineno // !< Line number of call54 void p_psFree(void *ptr, ///< Pointer to free 55 const char *file, ///< File of call 56 int lineno ///< Line number of call 57 57 ); 58 58 59 59 /// Check for memory leaks 60 int psMemCheckLeaks(int id0, // !< don't list blocks with id < id061 psMemBlock ***arr, // !< pointer to array of pointers to leaked blocks, or NULL62 FILE *fd // !< print list of leaks to fd (or NULL)60 int psMemCheckLeaks(int id0, ///< don't list blocks with id < id0 61 psMemBlock ***arr, ///< pointer to array of pointers to leaked blocks, or NULL 62 FILE *fd ///< print list of leaks to fd (or NULL) 63 63 ); 64 64 65 65 /// Check for memory corruption 66 int psMemCheckCorruption(int abort_on_error // !< Abort on detecting corruption?66 int psMemCheckCorruption(int abort_on_error ///< Abort on detecting corruption? 67 67 ); 68 68 69 69 /// Return reference counter 70 int psMemGetRefCounter(void *vptr // !< Pointer to get refCounter for70 int psMemGetRefCounter(void *vptr ///< Pointer to get refCounter for 71 71 ); 72 72 73 73 /// Increment reference counter and return the pointer 74 void *psMemIncrRefCounter(void *vptr // !< Pointer to increment refCounter, and return74 void *psMemIncrRefCounter(void *vptr ///< Pointer to increment refCounter, and return 75 75 ); 76 76 77 77 /// Decrement reference counter and return the pointer 78 void *psMemDecrRefCounter(void *vptr // !< Pointer to decrement refCounter, and return78 void *psMemDecrRefCounter(void *vptr ///< Pointer to decrement refCounter, and return 79 79 ); 80 80 81 81 /// Set callback for problems 82 psMemProblemCallback psMemProblemSetCB(psMemProblemCallback func // !< Function to run82 psMemProblemCallback psMemProblemSetCB(psMemProblemCallback func ///< Function to run 83 83 ); 84 84 85 85 /// Set callback for out-of-memory 86 psMemExhaustedCallback psMemExhaustedSetCB(psMemExhaustedCallback func // !< Function to run86 psMemExhaustedCallback psMemExhaustedSetCB(psMemExhaustedCallback func ///< Function to run 87 87 ); 88 88 89 89 /// Set call back for when a particular memory block is allocated 90 psMemCallback psMemAllocateSetCB(psMemCallback func // !< Function to run90 psMemCallback psMemAllocateSetCB(psMemCallback func ///< Function to run 91 91 ); 92 92 … … 99 99 100 100 /// set p_psMemAllocateID to id 101 long psMemSetAllocateID(long id // !< ID to set101 long psMemSetAllocateID(long id ///< ID to set 102 102 ); 103 103 104 104 /// set p_psMemFreeID to id 105 long psMemSetFreeID(long id // !< ID to set105 long psMemSetFreeID(long id ///< ID to set 106 106 ); 107 107
Note:
See TracChangeset
for help on using the changeset viewer.
