SUMO - Simulation of Urban MObility
debug_new.h File Reference
#include <new>
#include <stdio.h>
#include "_nvwa.h"
#include "c++11.h"
Include dependency graph for debug_new.h:

Go to the source code of this file.

Data Structures

class  debug_new_counter
 
class  debug_new_recorder
 

Macros

#define _DEBUG_NEW_REDEFINE_NEW   1
 
#define _DEBUG_NEW_TYPE   1
 
#define DEBUG_NEW   NVWA::debug_new_recorder(__FILE__, __LINE__) ->* new
 
#define new   DEBUG_NEW
 

Functions

int check_leaks ()
 
int check_mem_corruption ()
 
void operator delete (void *ptr, const char *file, int line) _NOEXCEPT
 
void operator delete[] (void *ptr, const char *file, int line) _NOEXCEPT
 
void * operator new (size_t size, const char *file, int line)
 
void * operator new[] (size_t size, const char *file, int line)
 

Variables

static debug_new_counter __debug_new_count
 
bool new_autocheck_flag
 
FILE * new_output_fp
 
const char * new_progname
 
bool new_verbose_flag
 

Detailed Description

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

Date
2013-10-06

Definition in file debug_new.h.

Macro Definition Documentation

§ _DEBUG_NEW_REDEFINE_NEW

#define _DEBUG_NEW_REDEFINE_NEW   1

Definition at line 78 of file debug_new.h.

§ _DEBUG_NEW_TYPE

#define _DEBUG_NEW_TYPE   1

Macro to indicate which variant of DEBUG_NEW is wanted. The default value 1 allows the use of placement new (like new(std::nothrow)), but the verbose output (when nvwa::new_verbose_flag is true) looks worse than some older versions (no file/line information for allocations). Define it to 2 to revert to the old behaviour that records file and line information directly on the call to operator new.

Definition at line 93 of file debug_new.h.

§ DEBUG_NEW

#define DEBUG_NEW   NVWA::debug_new_recorder(__FILE__, __LINE__) ->* 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 115 of file debug_new.h.

§ new

#define new   DEBUG_NEW

Definition at line 121 of file debug_new.h.

Function Documentation

§ check_leaks()

int check_leaks ( )

§ check_mem_corruption()

int check_mem_corruption ( )

§ operator delete()

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

§ operator delete[]()

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

§ operator new()

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

§ operator new[]()

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

Variable Documentation

§ __debug_new_count

debug_new_counter __debug_new_count
static

Counting object for each file including debug_new.h.

Definition at line 177 of file debug_new.h.

§ new_autocheck_flag

bool new_autocheck_flag

§ new_output_fp

FILE* new_output_fp

§ new_progname

const char* new_progname

§ new_verbose_flag

bool new_verbose_flag