# include <cppad/utility/memory_leak.hpp>
flag = memory_leak()
flag = memory_leak(add_static)
and its default value is zero. Static variables hold onto memory forever. If the argument
add_staticis present (and non-zero),
memory_leakadds this amount of memory to the inuse sum that corresponds to static variables in the program. A call with
add_staticshould be make after a routine that has static variables which use get_memory to allocate memory. The value of
add_staticshould 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.
add_staticis non-zero, the return value for
memory_leakis false. Otherwise, the return value for
memory_leakshould be false (indicating that the only allocated memory corresponds to static variables).
memory_leakis 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_leakis 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_leakis called, TrackCount will return a zero value. If it returns a non-zero value,
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.