[ADOL-C] Memory leak when using sparse_jac

heinrich at ma.tum.de heinrich at ma.tum.de
Tue Mar 29 08:20:24 EDT 2011


Hello everybody,

I am using ADOL-C and especially the function sparse_jac within a
Navier-Stokes solver. As I am doing shape optimization at the moment I
have to call the solver (and consequently sparse_jac) many (hundreds of)
times. I observed that the required memory is getting bigger and bigger,
which finally leads to a crash of the whole program (even on a big machine
with plenty of memory). I located the problem in the function sparse_jac.

The output of valgrind after 9 calls of sparse_jac is the following:

==20683== Memcheck, a memory error detector.
==20683== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al.
==20683== Using LibVEX rev 1884, a library for dynamic binary translation.
==20683== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.
==20683== Using valgrind-3.4.1-Debian, a dynamic binary instrumentation
framework.
==20683== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al.
==20683== For more details, rerun with: -v
==20683==
==20683== My PID = 20683, parent PID = 11926.  Prog and args are:
==20683==    ./repeatNavier
==20683==
==20683== Mismatched free() / delete / delete []
==20683==    at 0x402545A: operator delete[](void*) (vg_replace_malloc.c:364)
==20683==    by 0x8055069: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:112)
==20683==    by 0x804EEA5: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:127)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==  Address 0x4d283c8 is 0 bytes inside a block of size 4,608 alloc'd
==20683==    at 0x4026FDE: malloc (vg_replace_malloc.c:207)
==20683==    by 0x80F5E1D:
ColPack::JacobianRecovery1D::RecoverD2Cln_CoordinateFormat_unmanaged(ColPack::BipartiteGraphPartialColoringInterface*,
double**, unsigned int**, unsigned int**, unsigned int**, double**) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80C6665: sparse_jac (sparsedrivers.cpp:371)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EEA5: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:127)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683== Mismatched free() / delete / delete []
==20683==    at 0x402545A: operator delete[](void*) (vg_replace_malloc.c:364)
==20683==    by 0x805507B: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:113)
==20683==    by 0x804EEA5: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:127)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==  Address 0x4f7c3c8 is 0 bytes inside a block of size 4,608 alloc'd
==20683==    at 0x4026FDE: malloc (vg_replace_malloc.c:207)
==20683==    by 0x80F5E2A:
ColPack::JacobianRecovery1D::RecoverD2Cln_CoordinateFormat_unmanaged(ColPack::BipartiteGraphPartialColoringInterface*,
double**, unsigned int**, unsigned int**, unsigned int**, double**) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80C6665: sparse_jac (sparsedrivers.cpp:371)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EEA5: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:127)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683== Mismatched free() / delete / delete []
==20683==    at 0x402545A: operator delete[](void*) (vg_replace_malloc.c:364)
==20683==    by 0x8055091: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:114)
==20683==    by 0x804EEA5: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:127)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==  Address 0x4d295f8 is 0 bytes inside a block of size 9,216 alloc'd
==20683==    at 0x4026FDE: malloc (vg_replace_malloc.c:207)
==20683==    by 0x80F5E3E:
ColPack::JacobianRecovery1D::RecoverD2Cln_CoordinateFormat_unmanaged(ColPack::BipartiteGraphPartialColoringInterface*,
double**, unsigned int**, unsigned int**, unsigned int**, double**) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80C6665: sparse_jac (sparsedrivers.cpp:371)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EEA5: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:127)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683== Mismatched free() / delete / delete []
==20683==    at 0x402545A: operator delete[](void*) (vg_replace_malloc.c:364)
==20683==    by 0x8055069: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:112)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==  Address 0x45105e8 is 0 bytes inside a block of size 4,608 alloc'd
==20683==    at 0x4026FDE: malloc (vg_replace_malloc.c:207)
==20683==    by 0x80F5E1D:
ColPack::JacobianRecovery1D::RecoverD2Cln_CoordinateFormat_unmanaged(ColPack::BipartiteGraphPartialColoringInterface*,
double**, unsigned int**, unsigned int**, unsigned int**, double**) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80C6665: sparse_jac (sparsedrivers.cpp:371)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683== Mismatched free() / delete / delete []
==20683==    at 0x402545A: operator delete[](void*) (vg_replace_malloc.c:364)
==20683==    by 0x805507B: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:113)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==  Address 0x4511818 is 0 bytes inside a block of size 4,608 alloc'd
==20683==    at 0x4026FDE: malloc (vg_replace_malloc.c:207)
==20683==    by 0x80F5E2A:
ColPack::JacobianRecovery1D::RecoverD2Cln_CoordinateFormat_unmanaged(ColPack::BipartiteGraphPartialColoringInterface*,
double**, unsigned int**, unsigned int**, unsigned int**, double**) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80C6665: sparse_jac (sparsedrivers.cpp:371)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683== Mismatched free() / delete / delete []
==20683==    at 0x402545A: operator delete[](void*) (vg_replace_malloc.c:364)
==20683==    by 0x8055091: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:114)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==  Address 0x4d120f8 is 0 bytes inside a block of size 9,216 alloc'd
==20683==    at 0x4026FDE: malloc (vg_replace_malloc.c:207)
==20683==    by 0x80F5E3E:
ColPack::JacobianRecovery1D::RecoverD2Cln_CoordinateFormat_unmanaged(ColPack::BipartiteGraphPartialColoringInterface*,
double**, unsigned int**, unsigned int**, unsigned int**, double**) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80C6665: sparse_jac (sparsedrivers.cpp:371)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683== ERROR SUMMARY: 27 errors from 6 contexts (suppressed: 29 from 1)
==20683== malloc/free: in use at exit: 414,261 bytes in 2,430 blocks.
==20683== malloc/free: 7,351,168 allocs, 7,348,738 frees, 943,101,370
bytes allocated.
==20683== For counts of detected errors, rerun with: -v
==20683== searching for pointers to 2,430 not-freed blocks.
==20683== checked 195,836 bytes.
==20683==
==20683==
==20683== 52 bytes in 1 blocks are still reachable in loss record 1 of 24
==20683==    at 0x40269EE: operator new(unsigned int)
(vg_replace_malloc.c:224)
==20683==    by 0x80C6470: sparse_jac (sparsedrivers.cpp:303)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 73 bytes in 2 blocks are possibly lost in loss record 2 of 24
==20683==    at 0x40269EE: operator new(unsigned int)
(vg_replace_malloc.c:224)
==20683==    by 0x417B1A3: std::string::_Rep::_S_create(unsigned int,
unsigned int, std::allocator<char> const&) (new_allocator.h:92)
==20683==    by 0x417BE04: char* std::string::_S_construct<char
const*>(char const*, char const*, std::allocator<char> const&,
std::forward_iterator_tag) (basic_string.tcc:144)
==20683==    by 0x417BF75: std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::basic_string(char const*, std::allocator<char>
const&) (basic_string.h:1465)
==20683==    by 0x80FA75F:
ColPack::BipartiteGraphPartialColoring::PartialDistanceTwoColumnColoring()
(in /home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80E391A:
ColPack::BipartiteGraphPartialColoringInterface::PartialDistanceTwoColoring(std::string,
std::string) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80E3B80:
ColPack::BipartiteGraphPartialColoringInterface::GenerateSeedJacobian(double***,
int*, int*, std::string, std::string) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80C64F4: sparse_jac (sparsedrivers.cpp:314)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 328 bytes in 1 blocks are still reachable in loss record 3 of 24
==20683==    at 0x40269EE: operator new(unsigned int)
(vg_replace_malloc.c:224)
==20683==    by 0x80C6433: sparse_jac (sparsedrivers.cpp:302)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 416 bytes in 8 blocks are definitely lost in loss record 4 of 24
==20683==    at 0x40269EE: operator new(unsigned int)
(vg_replace_malloc.c:224)
==20683==    by 0x80C6470: sparse_jac (sparsedrivers.cpp:303)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 512 bytes in 1 blocks are still reachable in loss record 5 of 24
==20683==    at 0x4026FDE: malloc (vg_replace_malloc.c:207)
==20683==    by 0x80C639A: sparse_jac (sparsedrivers.cpp:267)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 512 bytes in 1 blocks are still reachable in loss record 6 of 24
==20683==    at 0x4026FDE: malloc (vg_replace_malloc.c:207)
==20683==    by 0x8107DB5: myalloc2 (adalloc.c:51)
==20683==    by 0x80C652E: sparse_jac (sparsedrivers.cpp:318)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 512 bytes in 1 blocks are still reachable in loss record 7 of 24
==20683==    at 0x402630E: operator new[](unsigned int)
(vg_replace_malloc.c:268)
==20683==    by 0x80F9684:
ColPack::BipartiteGraphPartialColoring::GetRightSeedMatrix_unmanaged(int*,
int*) (in /home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80F9AF3:
ColPack::BipartiteGraphPartialColoring::GetRightSeedMatrix(int*, int*) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80F9C1D:
ColPack::BipartiteGraphPartialColoring::GetSeedMatrix(int*, int*) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80E350A:
ColPack::BipartiteGraphPartialColoringInterface::GetSeedMatrix(int*, int*)
(in /home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80E3BB5:
ColPack::BipartiteGraphPartialColoringInterface::GenerateSeedJacobian(double***,
int*, int*, std::string, std::string) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80C64F4: sparse_jac (sparsedrivers.cpp:314)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 584 bytes in 16 blocks are indirectly lost in loss record 8 of 24
==20683==    at 0x40269EE: operator new(unsigned int)
(vg_replace_malloc.c:224)
==20683==    by 0x417B1A3: std::string::_Rep::_S_create(unsigned int,
unsigned int, std::allocator<char> const&) (new_allocator.h:92)
==20683==    by 0x417BE04: char* std::string::_S_construct<char
const*>(char const*, char const*, std::allocator<char> const&,
std::forward_iterator_tag) (basic_string.tcc:144)
==20683==    by 0x417BF75: std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::basic_string(char const*, std::allocator<char>
const&) (basic_string.h:1465)
==20683==    by 0x8135832:
ColPack::BipartiteGraphPartialOrdering::ColumnSmallestLastOrdering() (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x813742A:
ColPack::BipartiteGraphPartialOrdering::OrderVertices(std::string,
std::string) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80E379D:
ColPack::BipartiteGraphPartialColoringInterface::PartialDistanceTwoColoring(std::string,
std::string) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80E3B80:
ColPack::BipartiteGraphPartialColoringInterface::GenerateSeedJacobian(double***,
int*, int*, std::string, std::string) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80C64F4: sparse_jac (sparsedrivers.cpp:314)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 1,024 bytes in 1 blocks are still reachable in loss record 9 of 24
==20683==    at 0x4025092: calloc (vg_replace_malloc.c:397)
==20683==    by 0x8107B19: myalloc1 (adalloc.c:39)
==20683==    by 0x80C653C: sparse_jac (sparsedrivers.cpp:319)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 1,024 bytes in 2 blocks are still reachable in loss record 10 of 24
==20683==    at 0x40269EE: operator new(unsigned int)
(vg_replace_malloc.c:224)
==20683==    by 0x80DB1B3: std::vector<int, std::allocator<int>
>::_M_fill_insert(__gnu_cxx::__normal_iterator<int*, std::vector<int,
std::allocator<int> > >, unsigned int, int const&) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80FA9DC:
ColPack::BipartiteGraphPartialColoring::PartialDistanceTwoColumnColoring()
(in /home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80E391A:
ColPack::BipartiteGraphPartialColoringInterface::PartialDistanceTwoColoring(std::string,
std::string) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80E3B80:
ColPack::BipartiteGraphPartialColoringInterface::GenerateSeedJacobian(double***,
int*, int*, std::string, std::string) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80C64F4: sparse_jac (sparsedrivers.cpp:314)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 8,192 bytes in 16 blocks are indirectly lost in loss record 11
of 24
==20683==    at 0x40269EE: operator new(unsigned int)
(vg_replace_malloc.c:224)
==20683==    by 0x80DB1B3: std::vector<int, std::allocator<int>
>::_M_fill_insert(__gnu_cxx::__normal_iterator<int*, std::vector<int,
std::allocator<int> > >, unsigned int, int const&) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x813597B:
ColPack::BipartiteGraphPartialOrdering::ColumnSmallestLastOrdering() (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x813742A:
ColPack::BipartiteGraphPartialOrdering::OrderVertices(std::string,
std::string) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80E379D:
ColPack::BipartiteGraphPartialColoringInterface::PartialDistanceTwoColoring(std::string,
std::string) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80E3B80:
ColPack::BipartiteGraphPartialColoringInterface::GenerateSeedJacobian(double***,
int*, int*, std::string, std::string) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80C64F4: sparse_jac (sparsedrivers.cpp:314)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 13,312 bytes in 1 blocks are still reachable in loss record 12
of 24
==20683==    at 0x4025092: calloc (vg_replace_malloc.c:397)
==20683==    by 0x8107DAB: myalloc2 (adalloc.c:50)
==20683==    by 0x80C652E: sparse_jac (sparsedrivers.cpp:318)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 13,312 bytes in 128 blocks are still reachable in loss record 13
of 24
==20683==    at 0x402630E: operator new[](unsigned int)
(vg_replace_malloc.c:268)
==20683==    by 0x80F96AA:
ColPack::BipartiteGraphPartialColoring::GetRightSeedMatrix_unmanaged(int*,
int*) (in /home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80F9AF3:
ColPack::BipartiteGraphPartialColoring::GetRightSeedMatrix(int*, int*) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80F9C1D:
ColPack::BipartiteGraphPartialColoring::GetSeedMatrix(int*, int*) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80E350A:
ColPack::BipartiteGraphPartialColoringInterface::GetSeedMatrix(int*, int*)
(in /home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80E3BB5:
ColPack::BipartiteGraphPartialColoringInterface::GenerateSeedJacobian(double***,
int*, int*, std::string, std::string) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80C64F4: sparse_jac (sparsedrivers.cpp:314)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 81,984 bytes in 24 blocks are indirectly lost in loss record 14
of 24
==20683==    at 0x40269EE: operator new(unsigned int)
(vg_replace_malloc.c:224)
==20683==    by 0x81046C8: std::vector<int, std::allocator<int>
>::reserve(unsigned int) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x8129E2B:
ColPack::BipartiteGraphInputOutput::RowCompressedFormat2BipartiteGraph(unsigned
int**, int, int) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x812A1C1:
ColPack::BipartiteGraphInputOutput::BuildBPGraphFromRowCompressedFormat(unsigned
int**, int, int) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80E3F9F:
ColPack::BipartiteGraphPartialColoringInterface::BipartiteGraphPartialColoringInterface(int,
...) (in /home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80C6464: sparse_jac (sparsedrivers.cpp:302)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 203,976 (2,624 direct, 201,352 indirect) bytes in 8 blocks are
definitely lost in loss record 15 of 24
==20683==    at 0x40269EE: operator new(unsigned int)
(vg_replace_malloc.c:224)
==20683==    by 0x80C6433: sparse_jac (sparsedrivers.cpp:302)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 4,096 bytes in 8 blocks are indirectly lost in loss record 16 of 24
==20683==    at 0x402630E: operator new[](unsigned int)
(vg_replace_malloc.c:268)
==20683==    by 0x80F9684:
ColPack::BipartiteGraphPartialColoring::GetRightSeedMatrix_unmanaged(int*,
int*) (in /home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80F9AF3:
ColPack::BipartiteGraphPartialColoring::GetRightSeedMatrix(int*, int*) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80F9C1D:
ColPack::BipartiteGraphPartialColoring::GetSeedMatrix(int*, int*) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80E350A:
ColPack::BipartiteGraphPartialColoringInterface::GetSeedMatrix(int*, int*)
(in /home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80E3BB5:
ColPack::BipartiteGraphPartialColoringInterface::GenerateSeedJacobian(double***,
int*, int*, std::string, std::string) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80C64F4: sparse_jac (sparsedrivers.cpp:314)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 106,496 bytes in 8 blocks are indirectly lost in loss record 17
of 24
==20683==    at 0x4025092: calloc (vg_replace_malloc.c:397)
==20683==    by 0x8107DAB: myalloc2 (adalloc.c:50)
==20683==    by 0x80C652E: sparse_jac (sparsedrivers.cpp:318)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 106,496 bytes in 1,024 blocks are indirectly lost in loss record
18 of 24
==20683==    at 0x402630E: operator new[](unsigned int)
(vg_replace_malloc.c:268)
==20683==    by 0x80F96AA:
ColPack::BipartiteGraphPartialColoring::GetRightSeedMatrix_unmanaged(int*,
int*) (in /home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80F9AF3:
ColPack::BipartiteGraphPartialColoring::GetRightSeedMatrix(int*, int*) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80F9C1D:
ColPack::BipartiteGraphPartialColoring::GetSeedMatrix(int*, int*) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80E350A:
ColPack::BipartiteGraphPartialColoringInterface::GetSeedMatrix(int*, int*)
(in /home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80E3BB5:
ColPack::BipartiteGraphPartialColoringInterface::GenerateSeedJacobian(double***,
int*, int*, std::string, std::string) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80C64F4: sparse_jac (sparsedrivers.cpp:314)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 110,592 (4,096 direct, 106,496 indirect) bytes in 8 blocks are
definitely lost in loss record 19 of 24
==20683==    at 0x4026FDE: malloc (vg_replace_malloc.c:207)
==20683==    by 0x8107DB5: myalloc2 (adalloc.c:51)
==20683==    by 0x80C652E: sparse_jac (sparsedrivers.cpp:318)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 8,192 bytes in 8 blocks are definitely lost in loss record 20 of 24
==20683==    at 0x4025092: calloc (vg_replace_malloc.c:397)
==20683==    by 0x8107B19: myalloc1 (adalloc.c:39)
==20683==    by 0x80C653C: sparse_jac (sparsedrivers.cpp:319)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 10,248 bytes in 3 blocks are still reachable in loss record 21
of 24
==20683==    at 0x40269EE: operator new(unsigned int)
(vg_replace_malloc.c:224)
==20683==    by 0x81046C8: std::vector<int, std::allocator<int>
>::reserve(unsigned int) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x8129FFE:
ColPack::BipartiteGraphInputOutput::RowCompressedFormat2BipartiteGraph(unsigned
int**, int, int) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x812A1C1:
ColPack::BipartiteGraphInputOutput::BuildBPGraphFromRowCompressedFormat(unsigned
int**, int, int) (in
/home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80E3F9F:
ColPack::BipartiteGraphPartialColoringInterface::BipartiteGraphPartialColoringInterface(int,
...) (in /home/christoph/C++-Projekte/repeatNavier/valgrind/repeatNavier)
==20683==    by 0x80C6464: sparse_jac (sparsedrivers.cpp:302)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 45,056 (4,096 direct, 40,960 indirect) bytes in 8 blocks are
definitely lost in loss record 22 of 24
==20683==    at 0x4026FDE: malloc (vg_replace_malloc.c:207)
==20683==    by 0x80C639A: sparse_jac (sparsedrivers.cpp:267)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 5,120 bytes in 128 blocks are still reachable in loss record 23
of 24
==20683==    at 0x4026FDE: malloc (vg_replace_malloc.c:207)
==20683==    by 0x8123978: indopro_forward_safe (uni5_for.c:1341)
==20683==    by 0x80C521D: jac_pat (sparsedrivers.cpp:91)
==20683==    by 0x80C63CB: sparse_jac (sparsedrivers.cpp:268)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683==
==20683== 40,960 bytes in 1,024 blocks are indirectly lost in loss record
24 of 24
==20683==    at 0x4026FDE: malloc (vg_replace_malloc.c:207)
==20683==    by 0x8123978: indopro_forward_safe (uni5_for.c:1341)
==20683==    by 0x80C521D: jac_pat (sparsedrivers.cpp:91)
==20683==    by 0x80C63CB: sparse_jac (sparsedrivers.cpp:268)
==20683==    by 0x8055057: NewtonRelax(double*, double,
gmm::row_matrix<gmm::wsvector<double> >&, double*, int, int, double,
Go::SplineSurface&, controlVolume*, int) (NewtonRelax.cpp:111)
==20683==    by 0x804EF6D: NavierStokes2D(Go::SplineSurface&, int, double,
double, short, double, double, std::vector<double, std::allocator<double>
>&, std::vector<double, std::allocator<double> >&, std::vector<double,
std::allocator<double> >&, int, int) (NavierStokes2D.cpp:139)
==20683==    by 0x80A061E: main (main.cpp:71)
==20683==
==20683== LEAK SUMMARY:
==20683==    definitely lost: 19,424 bytes in 40 blocks.
==20683==    indirectly lost: 348,808 bytes in 2,120 blocks.
==20683==      possibly lost: 73 bytes in 2 blocks.
==20683==    still reachable: 45,956 bytes in 268 blocks.
==20683==         suppressed: 0 bytes in 0 blocks.


Has anybody encountered the same problem? Could anyone please give me a
hint how I can avoid this memory leak?

I am using the latest versions of ADOL-C (2.1.12) and ColPack (1.0.3) and
called the sparse_jac function as it is done in
/ADOL-C-2.1.12/ADOL-C/examples/additional_examples/sparse/sparse_jacobian.cpp

Thank you very much in advance!

Christoph



More information about the ADOL-C mailing list