[Ipopt] Memory Leaks

Daniel Feenberg feenberg at nber.org
Fri Nov 16 18:01:20 EST 2018


I am having some success finding optima, but if I run with the debugger enabled
I get complaints from ASAN about more than a 1,000 memory leaks during the
execution of the code. Other times (really most times) the solver converges to
an ifeasible region, even though there does exist a feasible solution. Should I
be concerned about the leaks? Do they suggest I have a bug in my fortran or is
there a known leak in the solver? For example, here are the first three
messages:


=================================================================
==18806==ERROR: LeakSanitizer: detected memory leaks
Indirect leak of 102213696 byte(s) in 1 object(s) allocated from:
     #0 0x4a8728 in __interceptor_malloc
        /usr/local/src/gcc-6.4.0/libsanitizer/asan/asan_malloc_linux.cc:62
     #1 0x2aaaada11519 in smalloc_setup coinhsl/hsl_ma97/hsl_ma97d.f90:8200
     #2 0x2aaaada320d5 in __hsl_ma97_double_MOD_ma97_factor_solve_double
        coinhsl/hsl_ma97/hsl_ma97d.f90:2428
     #3 0x2aaaada34e80 in __hsl_ma97_double_MOD_ma97_factor_double
        coinhsl/hsl_ma97/hsl_ma97d.f90:2024
     #4 0x2aaaada45037 in ma97_factor_d
coinhsl/hsl_ma97/C/hsl_ma97d_ciface.f90:429
     #5 0x2aaaaaeec915 in Ipopt::Ma97SolverInterface::MultiSolve(bool, int
const*,
        int const*, int, double*, bool, int)
(/usr/local/lib64/libipopt.so.1+0x21e915)

Indirect leak of 63307048 byte(s) in 1 object(s) allocated from:
     #0 0x4a8728 in __interceptor_malloc
        /usr/local/src/gcc-6.4.0/libsanitizer/asan/asan_malloc_linux.cc:62
     #1 0x2aaaada31714 in __hsl_ma97_double_MOD_ma97_factor_solve_double
        coinhsl/hsl_ma97/hsl_ma97d.f90:2387
     #2 0x2aaaada34e80 in __hsl_ma97_double_MOD_ma97_factor_double
        coinhsl/hsl_ma97/hsl_ma97d.f90:2024
     #3 0x2aaaada45037 in ma97_factor_d
coinhsl/hsl_ma97/C/hsl_ma97d_ciface.f90:429
     #4 0x2aaaaaeec915 in Ipopt::Ma97SolverInterface::MultiSolve(bool, int
const*,
        int const*, int, double*, bool, int)
(/usr/local/lib64/libipopt.so.1+0x21e915)

Indirect leak of 25317216 byte(s) in 4 object(s) allocated from:
     #0 0x4a9770 in operator new[](unsigned long)
        /usr/local/src/gcc-6.4.0/libsanitizer/asan/asan_new_delete.cc:62
     #1 0x2aaaaaf3ea54 in Ipopt::GenTMatrix::GenTMatrix(Ipopt::GenTMatrixSpace
const*)
        (/usr/local/lib64/libipopt.so.1+0x270a54)
Indirect leak of 16963328 byte(s) in 1 object(s) allocated from:
     #0 0x4a9770 in operator new[](unsigned long)
        /usr/local/src/gcc-6.4.0/libsanitizer/asan/asan_new_delete.cc:62
     #1 0x2aaaaaeec36e in Ipopt::Ma97SolverInterface::InitializeStructure(int,
int, int const*,
        int const*) (/usr/local/lib64/libipopt.so.1+0x21e36e)

Indirect leak of 16963328 byte(s) in 1 object(s) allocated from:
     #0 0x4a8728 in __interceptor_malloc
/usr/local/src/gcc-6.4.0/libsanitizer/asan/asan_malloc_linux.cc:62
     #1 0x2aaaada366ca in analyse_phase coinhsl/hsl_ma97/hsl_ma97d.f90:1799
     #2 0x2aaaada408ed in __hsl_ma97_double_MOD_analyse_double
coinhsl/hsl_ma97/hsl_ma97d.f90:769
     #3 0x2aaaada42562 in ma97_analyse_d
coinhsl/hsl_ma97/C/hsl_ma97d_ciface.f90:235
     #4 0x2aaaaaeec42e in Ipopt::Ma97SolverInterface::InitializeStructure(int,
int, int const*,
        int const*) (/usr/local/lib64/libipopt.so.1+0x21e42e)



This is Ipopt version 3.12.8, running with linear solver ma97. The compiler is
GNU Fortran (GCC) 6.4.0. Here is the script that compiles and runs the program:

setenv KMP_STACKSIZE 12000000
limit stacksize unlimited
setenv LD_LIBRARY_PATH
"/usr/local/lib64:/usr/lib64:/lib64:/usr/local/Ipopt/lib:\
        /usr/local/lib:/usr/lib:/lib"
setenv include /usr/local/Ipopt/Ipopt/src/Interfaces
/usr/local/bin/gfortran -fsanitize=address -fbounds-check -g \
     -fbacktrace -ffpe-trap=zero,overflow,underflow,invalid -L/usr/local/lib64 \
     -L/usr/local/Ipopt/lib -lipopt -llapack -ldl -lcoinmumps \
     -static-libasan \
     -lblas -lcoinmetis -lstdc++ -lm -I$include \
     max.f
setenv LD_LIBRARY_PATH
"/usr/local/lib64:/usr/lib64:/lib64:/usr/local/Ipopt/lib:\
       /usr/local/lib:/usr/lib:/lib"
gdb  ./a.out

If it is of any interest, I am maximizing an entropy function subject to linear
constraints on weight averages of the probabilities.

Daniel Feenberg
NBER


More information about the Ipopt mailing list