Ignore:
Timestamp:
Apr 29, 2010, 2:38:29 PM (16 years ago)
Author:
Tillmann Crueger <crueger@…>
Children:
16eb32
Parents:
0d111b
Message:

Improved comments for the memory tracker

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/Helpers/MemDebug.hpp

    r0d111b r5d1a94  
    99#define MEMDEBUG_HPP_
    1010
     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
    1124namespace Memory {
     25
     26  /**
     27   * Displays a short summary of the memory state.
     28   */
    1229  void getState();
    1330
    1431  void _ignore(void*);
    1532
     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   */
    1640  template <typename T>
    1741  T *ignore(T* ptr){
     
    2650void operator delete[] (void *ptr,const char*, int) throw();
    2751
    28 
     52/**
     53 * This macro replaces all occurences of the keyword new with a replaced
     54 * version that allows tracking.
     55 */
    2956#define new new(__FILE__,__LINE__)
    3057
Note: See TracChangeset for help on using the changeset viewer.