QxOrm  1.5.0
C++ Object Relational Mapping library
#include <new>
#include <stdio.h>
#include <QxCommon/QxMacro.h>

Go to the source code of this file.

Classes

class  qx::memory::__debug_new_recorder
class  qx::memory::__debug_new_counter

Namespaces

namespace  qx
 

Root namespace for all QxOrm library features.


namespace  qx::memory
 

QxOrm library memory leak detection (by Wu Yongwei)


Defines

#define HAVE_PLACEMENT_DELETE   1
#define _DEBUG_NEW_REDEFINE_NEW   1
#define _DEBUG_NEW_CALLER_ADDRESS   NULL
#define DEBUG_NEW   qx::memory::__debug_new_recorder(__FILE__, __LINE__, __FUNCTION__) ->* new
#define new   DEBUG_NEW

Functions

QX_DLL_EXPORT void * operator new (size_t size, const char *file, int line)
QX_DLL_EXPORT void * operator new[] (size_t size, const char *file, int line)
QX_DLL_EXPORT void operator delete (void *pointer, const char *file, int line) throw ()
QX_DLL_EXPORT void operator delete[] (void *pointer, const char *file, int line) throw ()
QX_DLL_EXPORT int qx::memory::check_leaks ()
QX_DLL_EXPORT int qx::memory::check_mem_corruption ()

Variables

bool qx::memory::new_autocheck_flag
bool qx::memory::new_verbose_flag
FILE * qx::memory::new_output_fp
const char * qx::memory::new_progname
static __debug_new_counter qx::memory::__debug_new_count

Detailed Description

Header file for checking leaks caused by unmatched new/delete.

Version:
4.4, 2007/12/31
Author:
Wu Yongwei

Definition in file debug_new.h.


Define Documentation

#define _DEBUG_NEW_CALLER_ADDRESS   NULL

The expression to return the caller address. print_position will later on use this address to print the position information of memory operation points.

Definition at line 110 of file debug_new.h.

#define _DEBUG_NEW_REDEFINE_NEW   1

Macro to indicate whether redefinition of new is wanted. If one wants to define one's own operator new, to call operator new directly, or to call placement new, it should be defined to 0 to alter the default behaviour. Unless, of course, one is willing to take the trouble to write something like:

 # ifdef new
 #   define _NEW_REDEFINED
 #   undef new
 # endif

 // Code that uses new is here

 # ifdef _NEW_REDEFINED
 #   ifdef DEBUG_NEW
 #     define new DEBUG_NEW
 #   endif
 #   undef _NEW_REDEFINED
 # endif

Definition at line 96 of file debug_new.h.

#define DEBUG_NEW   qx::memory::__debug_new_recorder(__FILE__, __LINE__, __FUNCTION__) ->* new

Macro to catch file/line information on allocation. If _DEBUG_NEW_REDEFINE_NEW is 0, one can use this macro directly; otherwise new will be defined to it, and one must use new instead.

Definition at line 122 of file debug_new.h.

#define HAVE_PLACEMENT_DELETE   1

Macro to indicate whether placement delete operators are supported on a certain compiler. Some compilers, like Borland C++ Compiler 5.5.1 and Digital Mars Compiler 8.42, do not support them, and the user must define this macro to 0 to make the program compile. Also note that in that case memory leakage will occur if an exception is thrown in the initialization (constructor) of a dynamically created object.

Definition at line 68 of file debug_new.h.

#define new   DEBUG_NEW

Definition at line 125 of file debug_new.h.


Function Documentation

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