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 .

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

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.

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

This argument has prototype
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
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.

The return value flag has prototype
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).

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.

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.

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