Changeset 5d1a94 for molecuilder/src/Helpers/MemDebug.hpp
- Timestamp:
- Apr 29, 2010, 2:38:29 PM (16 years ago)
- Children:
- 16eb32
- Parents:
- 0d111b
- File:
-
- 1 edited
-
molecuilder/src/Helpers/MemDebug.hpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/Helpers/MemDebug.hpp
r0d111b r5d1a94 9 9 #define MEMDEBUG_HPP_ 10 10 11 /** 12 * @file 13 * This module allows easy automatic memory tracking. Link this module to replace the 14 * operators new, new[], delete and delete[] with custom versions that add tracking 15 * information to allocated blocks. 16 * 17 * All tracking is done in O(1) for new and delete operators. Summaries for the 18 * used memory take O(N), where N is the number of currently allocated memory chunks. 19 * 20 * To use full tracking including file name and line number include this file in 21 * your sourcefiles. 22 */ 23 11 24 namespace Memory { 25 26 /** 27 * Displays a short summary of the memory state. 28 */ 12 29 void getState(); 13 30 14 31 void _ignore(void*); 15 32 33 /** 34 * Use this to disable memory for a certain pointer on the heap. 35 * This is useful for pointers which should live over the run of the 36 * program, and which are deleted automatically at the end. Usually these 37 * pointers should be wrapped inside some kind of smart pointer to 38 * ensure destruction at the end. 39 */ 16 40 template <typename T> 17 41 T *ignore(T* ptr){ … … 26 50 void operator delete[] (void *ptr,const char*, int) throw(); 27 51 28 52 /** 53 * This macro replaces all occurences of the keyword new with a replaced 54 * version that allows tracking. 55 */ 29 56 #define new new(__FILE__,__LINE__) 30 57
Note:
See TracChangeset
for help on using the changeset viewer.
