Prev Next memory_leak

@(@\newcommand{\W}[1]{ \; #1 \; } \newcommand{\R}[1]{ {\rm #1} } \newcommand{\B}[1]{ {\bf #1} } \newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} } \newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} } \newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} } \newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }@)@
Memory Leak Detection

Deprecated 2012-04-06
This routine has been deprecated. You should instead use the routine ta_free_all .

Syntax
# include <cppad/utility/memory_leak.hpp>
flag = memory_leak()
flag = memory_leak(add_static)

Purpose
This routine checks that the are no memory leaks caused by improper use of thread_alloc memory allocator. The deprecated memory allocator TrackNewDel is also checked. Memory errors in the deprecated omp_alloc allocator are reported as being in thread_alloc.

thread
It is assumed that in_parallel() is false and thread_num is zero when memory_leak is called.

add_static
This argument has prototype
     size_t 
add_static
and its default value is zero. Static variables hold onto memory forever. If the argument add_static is present (and non-zero), memory_leak adds this amount of memory to the inuse sum that corresponds to static variables in the program. A call with add_static should be make after a routine that has static variables which use get_memory to allocate memory. The value of add_static should be the difference of
     thread_alloc::inuse(0)
before and after the call. Since multiple statics may be allocated in different places in the program, it is expected that there will be multiple calls that use this option.

flag
The return value flag has prototype
     bool 
flag
If add_static is non-zero, the return value for memory_leak is false. Otherwise, the return value for memory_leak should be false (indicating that the only allocated memory corresponds to static variables).

inuse
It is assumed that, when memory_leak is called, there should not be any memory inuse or omp_inuse for any thread (except for inuse memory corresponding to static variables). If there is, a message is printed and memory_leak returns false.

available
It is assumed that, when memory_leak is called, there should not be any memory available or omp_available for any thread; i.e., it all has been returned to the system. If there is memory still available for any thread, memory_leak returns false.

TRACK_COUNT
It is assumed that, when memory_leak is called, TrackCount will return a zero value. If it returns a non-zero value, memory_leak returns false.

Error Message
If this is the first call to memory_leak, no message is printed. Otherwise, if it returns true, an error message is printed to standard output describing the memory leak that was detected.
Input File: cppad/utility/memory_leak.hpp