edbee - Qt Editor Library
Namespaces | Macros | Functions
debug_new.h File Reference
#include <stdlib.h>
#include <stdio.h>
+ Include dependency graph for debug_new.h:

Go to the source code of this file.

Namespaces

 edbee
 Copyright 2011-2013 - Reliable Bits Software by Blommers IT.
 

Macros

#define debug_new   new(__FILE__, __LINE__)
 
#define new   debug_new
 
#define malloc(A)   debug_malloc((A), __FILE__, __LINE__)
 
#define free(A)   debug_free((A), __FILE__, __LINE__)
 

Functions

void * debug_malloc (size_t size, const char *file, const int line)
 Copyright 2011-2013 - Reliable Bits Software by Blommers IT. More...
 
void debug_free (void *p, const char *file, const int line)
 frees the given pointer More...
 
void * operator new (size_t size, const char *file, const int line)
 the new operator More...
 
void operator delete (void *p, const char *file, const int line)
 th delete operator More...
 
void operator delete (void *p) throw ()
 the delete operator More...
 
void * operator new[] (size_t size, const char *file, const int line)
 the new array operator More...
 
void operator delete[] (void *p, const char *file, const int line)
 the delete array operator More...
 
void operator delete[] (void *p) throw ()
 the delete array operator More...
 
void edbee::pause_memleak_detection (bool value)
 pauses the memoryleak detection More...
 

Macro Definition Documentation

◆ debug_new

#define debug_new   new(__FILE__, __LINE__)

◆ free

#define free (   A)    debug_free((A), __FILE__, __LINE__)

◆ malloc

#define malloc (   A)    debug_malloc((A), __FILE__, __LINE__)

◆ new

#define new   debug_new

Function Documentation

◆ debug_free()

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

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
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 
)

Copyright 2011-2013 - Reliable Bits Software by Blommers IT.

Logs a malloc operation.

All Rights Reserved. Author Rick Blommers

Copyright 2011-2013 - Reliable Bits Software by Blommers IT.

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

◆ operator delete() [1/2]

void operator delete ( void *  p,
const char *  file,
const int  line 
)

th delete operator

◆ operator delete() [2/2]

void operator delete ( void *  p)
throw (
)

the delete operator

◆ operator delete[]() [1/2]

void operator delete[] ( void *  p,
const char *  file,
const int  line 
)

the delete array operator

◆ operator delete[]() [2/2]

void operator delete[] ( void *  p)
throw (
)

the delete array operator

◆ operator new()

void* operator new ( size_t  size,
const char *  file,
const int  line 
)

the new operator

◆ operator new[]()

void* operator new[] ( size_t  size,
const char *  file,
const int  line 
)

the new array operator