Changeset 1426 for trunk/psLib/src/sysUtils/psMemory.h
- Timestamp:
- Aug 9, 2004, 12:44:25 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/sysUtils/psMemory.h (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sysUtils/psMemory.h
r1407 r1426 15 15 * @ingroup MemoryManagement 16 16 * 17 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $18 * @date $Date: 2004-08-0 7 00:06:06$17 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 18 * @date $Date: 2004-08-09 22:44:25 $ 19 19 * 20 20 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 63 63 typedef struct psMemBlock 64 64 { 65 const void *startblock; // /< initialised to p_psMEMMAGIC66 struct psMemBlock *previousBlock; // /< previous block in allocation list67 struct psMemBlock *nextBlock; // /< next block allocation list68 psFreeFcn freeFcn; // /< deallocator. If NULL, use generic deallocation.69 size_t userMemorySize; // /< the size of the user-portion of the memory block70 const psMemoryId id; // /< a unique ID for this allocation71 const char *file; // /< set from __FILE__ in e.g. p_psAlloc72 const int lineno; // /< set from __LINE__ in e.g. p_psAlloc73 pthread_mutex_t refCounterMutex; // /< mutex to ensure exclusive access to reference counter74 psReferenceCount refCounter; // /< how many times pointer is referenced75 const void *endblock; // /< initialised to p_psMEMMAGIC65 const void *startblock; ///< initialised to p_psMEMMAGIC 66 struct psMemBlock *previousBlock; ///< previous block in allocation list 67 struct psMemBlock *nextBlock; ///< next block allocation list 68 psFreeFcn freeFcn; ///< deallocator. If NULL, use generic deallocation. 69 size_t userMemorySize; ///< the size of the user-portion of the memory block 70 const psMemoryId id; ///< a unique ID for this allocation 71 const char *file; ///< set from __FILE__ in e.g. p_psAlloc 72 const int lineno; ///< set from __LINE__ in e.g. p_psAlloc 73 pthread_mutex_t refCounterMutex; ///< mutex to ensure exclusive access to reference counter 74 psReferenceCount refCounter; ///< how many times pointer is referenced 75 const void *endblock; ///< initialised to p_psMEMMAGIC 76 76 } 77 77 psMemBlock; … … 82 82 * @ingroup memCallback 83 83 */ 84 typedef psMemoryId(*psMemAllocateCallback) (const psMemBlock * ptr // /< the psMemBlock just allocated84 typedef psMemoryId(*psMemAllocateCallback) (const psMemBlock * ptr ///< the psMemBlock just allocated 85 85 ); 86 86 … … 90 90 * @ingroup memCallback 91 91 */ 92 typedef psMemoryId(*psMemFreeCallback) (const psMemBlock * ptr // /< the psMemBlock being freed92 typedef psMemoryId(*psMemFreeCallback) (const psMemBlock * ptr ///< the psMemBlock being freed 93 93 ); 94 94 … … 100 100 * @ingroup memCallback 101 101 */ 102 typedef void (*psMemProblemCallback) (const psMemBlock * ptr, // /< the pointer to the problematic memory102 typedef void (*psMemProblemCallback) (const psMemBlock * ptr, ///< the pointer to the problematic memory 103 103 // block. 104 const char *file, // /< the file in which the problem originated105 int lineno // /< the line number in which the problem originated104 const char *file, ///< the file in which the problem originated 105 int lineno ///< the line number in which the problem originated 106 106 ); 107 107 … … 123 123 */ 124 124 # ifdef DOXYGEN 125 void *psAlloc(size_t size // /< Size required125 void *psAlloc(size_t size ///< Size required 126 126 ); 127 127 # else 128 void *p_psAlloc(size_t size, // /< Size required 129 const char *file, // /< File of call 130 int lineno // /< Line number of call 128 129 void *p_psAlloc(size_t size, ///< Size required 130 const char *file, ///< File of call 131 int lineno ///< Line number of call 131 132 ); 132 133 … … 144 145 */ 145 146 # ifdef DOXYGEN 146 void *psRealloc(void *ptr // /< Pointer to re-allocate147 size_t size, // /< Size required147 void *psRealloc(void *ptr ///< Pointer to re-allocate 148 size_t size, ///< Size required 148 149 ); 149 150 # else 150 void *p_psRealloc(void *ptr, // /< Pointer to re-allocate 151 size_t size, // /< Size required 152 const char *file, // /< File of call 153 int lineno // /< Line number of call 151 152 void *p_psRealloc(void *ptr, ///< Pointer to re-allocate 153 size_t size, ///< Size required 154 const char *file, ///< File of call 155 int lineno ///< Line number of call 154 156 ); 155 157 … … 164 166 */ 165 167 # ifdef DOXYGEN 166 void psFree(void *ptr, // /< Pointer to free, if NULL, function returns immediately.168 void psFree(void *ptr, ///< Pointer to free, if NULL, function returns immediately. 167 169 ); 168 170 # else 169 void p_psFree(void *ptr, // /< Pointer to free 170 const char *file, // /< File of call 171 int lineno // /< Line number of call 171 172 void p_psFree(void *ptr, ///< Pointer to free 173 const char *file, ///< File of call 174 int lineno ///< Line number of call 172 175 ); 173 176 … … 191 194 * @ingroup memTracing 192 195 */ 193 int psMemCheckLeaks(psMemoryId id0, // /< don't list blocks with id < id0194 psMemBlock *** arr, // /< pointer to array of pointers to leaked blocks, or NULL195 FILE * fd // /< print list of leaks to fd (or NULL)196 int psMemCheckLeaks(psMemoryId id0, ///< don't list blocks with id < id0 197 psMemBlock *** arr, ///< pointer to array of pointers to leaked blocks, or NULL 198 FILE * fd ///< print list of leaks to fd (or NULL) 196 199 ); 197 200 … … 201 204 * @ingroup memTracing 202 205 */ 203 int psMemCheckCorruption(bool abort_on_error // /< Abort on detecting corruption?206 int psMemCheckCorruption(bool abort_on_error ///< Abort on detecting corruption? 204 207 ); 205 208 … … 208 211 * @ingroup memRefCount 209 212 */ 210 psReferenceCount psMemGetRefCounter(void *vptr // /< Pointer to get refCounter for213 psReferenceCount psMemGetRefCounter(void *vptr ///< Pointer to get refCounter for 211 214 ); 212 215 … … 216 219 */ 217 220 # ifdef DOXYGEN 218 void *psMemIncrRefCounter(void *vptr // /< Pointer to increment refCounter, and return221 void *psMemIncrRefCounter(void *vptr ///< Pointer to increment refCounter, and return 219 222 ); 220 223 # else 221 void *p_psMemIncrRefCounter(void *vptr, // /< Pointer to increment refCounter, and return 222 const char *file, // /< File of call 223 int lineno // /< Line number of call 224 225 void *p_psMemIncrRefCounter(void *vptr, ///< Pointer to increment refCounter, and return 226 const char *file, ///< File of call 227 int lineno ///< Line number of call 224 228 ); 225 229 … … 232 236 */ 233 237 # ifdef DOXYGEN 234 void *psMemDecrRefCounter(void *vptr // /< Pointer to decrement refCounter, and return238 void *psMemDecrRefCounter(void *vptr ///< Pointer to decrement refCounter, and return 235 239 ); 236 240 # else 237 void *p_psMemDecrRefCounter(void *vptr, // /< Pointer to decrement refCounter, and return 238 const char *file, // /< File of call 239 int lineno // /< Line number of call 241 242 void *p_psMemDecrRefCounter(void *vptr, ///< Pointer to decrement refCounter, and return 243 const char *file, ///< File of call 244 int lineno ///< Line number of call 240 245 ); 241 246 … … 246 251 * @ingroup memCallback 247 252 */ 248 psMemProblemCallback psMemProblemCallbackSet(psMemProblemCallback func // /< Function to run253 psMemProblemCallback psMemProblemCallbackSet(psMemProblemCallback func ///< Function to run 249 254 ); 250 255 … … 253 258 * @ingroup memCallback 254 259 */ 255 psMemExhaustedCallback psMemExhaustedCallbackSet(psMemExhaustedCallback func // /< Function to run260 psMemExhaustedCallback psMemExhaustedCallbackSet(psMemExhaustedCallback func ///< Function to run 256 261 ); 257 262 … … 260 265 * @ingroup memCallback 261 266 */ 262 psMemAllocateCallback psMemAllocateCallbackSet(psMemAllocateCallback func // /< Function to run267 psMemAllocateCallback psMemAllocateCallbackSet(psMemAllocateCallback func ///< Function to run 263 268 ); 264 269 … … 267 272 * @ingroup memCallback 268 273 */ 269 psMemFreeCallback psMemFreeCallbackSet(psMemFreeCallback func // /< Function to run274 psMemFreeCallback psMemFreeCallbackSet(psMemFreeCallback func ///< Function to run 270 275 ); 271 276 … … 280 285 * @ingroup memCallback 281 286 */ 282 psMemoryId psMemAllocateCallbackSetID(psMemoryId id // /< ID to set287 psMemoryId psMemAllocateCallbackSetID(psMemoryId id ///< ID to set 283 288 ); 284 289 … … 287 292 * @ingroup memCallback 288 293 */ 289 psMemoryId psMemFreeCallbackSetID(psMemoryId id // /< ID to set294 psMemoryId psMemFreeCallbackSetID(psMemoryId id ///< ID to set 290 295 ); 291 296
Note:
See TracChangeset
for help on using the changeset viewer.
