Prev | Next | memory_leak |
# include <cppad/utility/memory_leak.hpp>
flag = memory_leak()
flag = memory_leak(add_static)
thread_alloc
.
memory_leak
is called.
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
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).
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.
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.
memory_leak
is called,
TrackCount
will return a zero value.
If it returns a non-zero value,
memory_leak
returns false.
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.