|
Nvwa
1.1
|
Header file for checking leaks caused by unmatched new/delete. More...
Go to the source code of this file.
Classes | |
| class | nvwa::debug_new_recorder |
| Recorder class to remember the call context. More... | |
| class | nvwa::debug_new_counter |
| Counter class for on-exit leakage check. More... | |
Namespaces | |
| nvwa | |
| Namespace of the nvwa project. | |
Macros | |
| #define | _DEBUG_NEW_TYPE 1 |
| Macro to indicate which variant of DEBUG_NEW is wanted. More... | |
| #define | DEBUG_NEW NVWA::debug_new_recorder(__FILE__, __LINE__) ->* new |
| Macro to catch file/line information on allocation. More... | |
Typedefs | |
| typedef void(* | nvwa::stacktrace_print_callback_t) (FILE *fp, void **stacktrace) |
| Callback type for stack trace printing. More... | |
| typedef bool(* | nvwa::leak_whitelist_callback_t) (char const *file, int line, void *addr, void **stacktrace) |
| Callback type for the leak whitelist function. More... | |
Functions | |
| void * | operator new (size_t size, const char *file, int line) |
| Allocates memory with file/line information. More... | |
| void * | operator new[] (size_t size, const char *file, int line) |
| Allocates array memory with file/line information. More... | |
| void | operator delete (void *ptr, const char *file, int line) noexcept |
| Placement deallocation function. More... | |
| void | operator delete[] (void *ptr, const char *file, int line) noexcept |
| Placement deallocation function. More... | |
| int | nvwa::check_leaks () |
| Checks for memory leaks. More... | |
| int | nvwa::check_mem_corruption () |
| Checks for heap corruption. More... | |
Variables | |
| bool | nvwa::new_autocheck_flag = true |
| Flag to control whether nvwa::check_leaks will be automatically called on program exit. | |
| bool | nvwa::new_verbose_flag = false |
| Flag to control whether verbose messages are output. | |
| FILE * | nvwa::new_output_fp = stderr |
| Pointer to the output stream. More... | |
| const char * | nvwa::new_progname = _DEBUG_NEW_PROGNAME |
| Pointer to the program name. More... | |
| stacktrace_print_callback_t | nvwa::stacktrace_print_callback = nullptr |
| Pointer to the callback used to print the stack backtrace in case of a memory problem. More... | |
| leak_whitelist_callback_t | nvwa::leak_whitelist_callback = nullptr |
| Pointer to the callback used to filter out false positives from leak reports. More... | |
| static debug_new_counter | nvwa::__debug_new_count |
| Counting object for each file including debug_new.h. More... | |
Header file for checking leaks caused by unmatched new/delete.
| #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.
| #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.
|
noexcept |
Placement deallocation function.
For details, please check Section 5.3.4 of the C++ 1998 or 2011 Standard.
| ptr | pointer to the previously allocated memory |
| file | null-terminated string of the file name |
| line | line number |
|
noexcept |
Placement deallocation function.
For details, please check Section 5.3.4 of the C++ 1998 or 2011 Standard.
| ptr | pointer to the previously allocated memory |
| file | null-terminated string of the file name |
| line | line number |
| void* operator new | ( | size_t | size, |
| const char * | file, | ||
| int | line | ||
| ) |
Allocates memory with file/line information.
| size | size of the required memory block |
| file | null-terminated string of the file name |
| line | line number |
| bad_alloc | memory is insufficient (_DEBUG_NEW_STD_OPER_NEW is 1) |
| void* operator new[] | ( | size_t | size, |
| const char * | file, | ||
| int | line | ||
| ) |
Allocates array memory with file/line information.
| size | size of the required memory block |
| file | null-terminated string of the file name |
| line | line number |
| bad_alloc | memory is insufficient (_DEBUG_NEW_STD_OPER_NEW is 1) |
1.8.13