SYS_MemoryUser Class Reference

#include <SYS_Memory.h>

List of all members.

Public Member Functions

 SYS_MemoryUser (const char *label)
 SYS_MemoryUser (const SYS_MemoryUser &rhs)
const char * getLabel () const
size_t getUsed () const
size_t getPeak () const
void inc (size_t amount)
void dec (size_t amount)


Detailed Description

Memory Tracking

This class provides a mechanism for tracking memory usage. If all memory allocation and freeing is registered with this class, then the memory footprint and resource usage can be tracked.

There is a companion class at UT which allows for printing of the memory statistics.

An example of how to use this might be:

enum { MEM_DEBUG = 0, MEM_TASK1, MEM_TASK2, MEM_MAX_TASKS };

static SYS_MemoryUser theMemoryUsers[MEM_MAX_TASKS] = { SYS_MemoryUser("Debug), SYS_MemoryUser("Task One"), SYS_MemoryUser("Task Two"), };

static SYS_MemoryTable theMemoryTable(theMemoryUsers, sizeof(theMemoryUsers)/sizeof(SYS_MemoryTable));

int main(int argc, char *argv[]) { UT_WorkBuffer stats; void *mem; mem = SYS_Memory::Malloc(theMemoryTable, MEM_TASK1, 128); mem = SYS_Memory::Realloc(theMemoryTable, MEM_TASK1, mem, 128, 256); SYS_Memory::Free(theMemoryTable, MEM_TASK1, mem, 256); UT_Memory::printTable(stats, theMemoryTable); cout << stats.buffer(); return 0; }

Definition at line 70 of file SYS_Memory.h.


Constructor & Destructor Documentation

SYS_MemoryUser::SYS_MemoryUser ( const char *  label  )  [inline]

Definition at line 72 of file SYS_Memory.h.

SYS_MemoryUser::SYS_MemoryUser ( const SYS_MemoryUser rhs  )  [inline]

Definition at line 80 of file SYS_Memory.h.


Member Function Documentation

void SYS_MemoryUser::dec ( size_t  amount  )  [inline]

Definition at line 95 of file SYS_Memory.h.

const char* SYS_MemoryUser::getLabel (  )  const [inline]

Definition at line 87 of file SYS_Memory.h.

size_t SYS_MemoryUser::getPeak (  )  const [inline]

Definition at line 89 of file SYS_Memory.h.

size_t SYS_MemoryUser::getUsed (  )  const [inline]

Definition at line 88 of file SYS_Memory.h.

void SYS_MemoryUser::inc ( size_t  amount  )  [inline]

Definition at line 91 of file SYS_Memory.h.


The documentation for this class was generated from the following file:

Generated on Fri May 25 00:10:42 2012 for HDK by  doxygen 1.5.9