edbee - Qt Editor Library
Public Member Functions | Static Public Member Functions | Friends | List of all members
edbee::DebugAllocationList Class Reference

This class is used to remember all memory leakds. More...

#include <debug_allocs.h>

+ Collaboration diagram for edbee::DebugAllocationList:

Public Member Functions

 DebugAllocationList ()
 cnostructs the allocation list More...
 
virtual ~DebugAllocationList ()
 The allocation list destructor. More...
 
void clear ()
 clears the debugging allocation list More...
 
int size ()
 
bool isRunning ()
 
void pause (bool val)
 
QMutex * mutex ()
 Retuns the mutex for thread-safety. More...
 
void start (bool checkDelete)
 Starts the monitoring of allocations. More...
 
int stop ()
 Stops the monitoring of allocations. More...
 
DebugAllocationfind (void *p)
 Finds the given pointer int the allocation list. More...
 
DebugAllocationadd (void *p, size_t size, char *file, int line)
 Adds the given pointer to the allocation list. More...
 
bool del (void *p)
 removes the given pointer from the allocation list More...
 
bool checkDelete ()
 returns the state of checkdelete More...
 

Static Public Member Functions

static DebugAllocationListinstance ()
 returns the allocation list instance More...
 

Friends

void * debug_malloc (size_t size, const char *file, const int line)
 Logs a malloc operation. More...
 
void debug_free (void *p, const char *file, const int line)
 frees the given pointer More...
 

Detailed Description

This class is used to remember all memory leakds.

Constructor & Destructor Documentation

◆ DebugAllocationList()

edbee::DebugAllocationList::DebugAllocationList ( )

cnostructs the allocation list

◆ ~DebugAllocationList()

edbee::DebugAllocationList::~DebugAllocationList ( )
virtual

The allocation list destructor.

Member Function Documentation

◆ add()

DebugAllocation * edbee::DebugAllocationList::add ( void *  p,
size_t  size,
char *  file,
int  line 
)

Adds the given pointer to the allocation list.

Parameters
ppointer
sizethe size of the pointer
filethe source file of the allocation
linethe line number of the allocation

◆ checkDelete()

bool edbee::DebugAllocationList::checkDelete ( )

returns the state of checkdelete

◆ clear()

void edbee::DebugAllocationList::clear ( )

clears the debugging allocation list

◆ del()

bool edbee::DebugAllocationList::del ( void *  p)

removes the given pointer from the allocation list

Parameters
pthe pointer

◆ find()

DebugAllocation * edbee::DebugAllocationList::find ( void *  p)

Finds the given pointer int the allocation list.

Parameters
pthe pointer to search
Returns
the allocation object

◆ instance()

DebugAllocationList * edbee::DebugAllocationList::instance ( )
static

returns the allocation list instance

◆ isRunning()

bool edbee::DebugAllocationList::isRunning ( )
inline

◆ mutex()

QMutex * edbee::DebugAllocationList::mutex ( )

Retuns the mutex for thread-safety.

◆ pause()

void edbee::DebugAllocationList::pause ( bool  val)
inline

◆ size()

int edbee::DebugAllocationList::size ( )
inline

◆ start()

void edbee::DebugAllocationList::start ( bool  checkDelete)

Starts the monitoring of allocations.

Parameters
checkDeleteshould the delete operation be checked?

◆ stop()

int edbee::DebugAllocationList::stop ( )

Stops the monitoring of allocations.

Friends And Related Function Documentation

◆ debug_free

void debug_free ( void *  p,
const char *  file,
const int  line 
)
friend

frees the given pointer

Parameters
pthe pointer to free
filethe file which call originated from
linethe linenumber of the delete
Todo:
: This doesn't work very good. It sees to many free that are NOT allocated by us

◆ debug_malloc

void* debug_malloc ( size_t  size,
const char *  file,
const int  line 
)
friend

Logs a malloc operation.

Parameters
sizethe size of reseved bytes
filethe file of the malloc
linethe line number of the allocation

All Rights Reserved. Author Rick Blommers


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