Re: [eigen] memory errors and leaks in test_sparse_solvers

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


hi;

both problems solved

cheers,
gael

On Mon, Apr 6, 2009 at 9:50 AM, Moritz Lenz
<mlenz@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> The SuperLU backend leaks memory, and there seem to be some problems in
> test_sparse solvers, as the valgrind output below shows:
>
> valgrind --leak-check=full ./test_sparse_solvers r1
> ==4176== Memcheck, a memory error detector.
> ==4176== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
> ==4176== Using LibVEX rev 1854, a library for dynamic binary translation.
> ==4176== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP..
> ==4176== Using valgrind-3.3.1-Debian, a dynamic binary instrumentation
> framework.
> ==4176== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
> ==4176== For more details, rerun with: -v
> ==4176==
> Initializing random number generator with seed 1239002052
> Repeating each test 1 times
> ==4176== Invalid read of size 4
> ==4176==    at 0x4CB942: Eigen::SparseMatrix<double,
> 0>::InnerIterator::index() const (SparseMatrix.h:434)
> ==4176==    by 0x4CDAC0:
> Eigen::ei_sparse_solve_triangular_selector<Eigen::SparseMatrix<double,
> 0>, Eigen::Matrix<double, 33331, 1, 0, 33331, 1>, 2304, 2048,
> 0>::run(Eigen::SparseMatrix<double, 0> const&, Eigen::Matrix<double,
> 33331, 1, 0, 33331, 1>&) (TriangularSolver.h:122)
> ==4176==    by 0x4EEF7C: void
> Eigen::SparseTriangular<Eigen::SparseMatrix<double, 0>,
> 2304>::solveInPlace<Eigen::Matrix<double, 33331, 1, 0, 33331, 1>
>>(Eigen::MatrixBase<Eigen::Matrix<double, 33331, 1, 0, 33331, 1> >&)
> const (TriangularSolver.h:176)
> ==4176==    by 0x51106C: bool
> Eigen::SparseLDLT<Eigen::SparseMatrix<double, 1536>,
> 0>::solveInPlace<Eigen::Matrix<double, 33331, 1, 0, 33331, 1>
>>(Eigen::MatrixBase<Eigen::Matrix<double, 33331, 1, 0, 33331, 1> >&)
> const (SparseLDLT.h:336)
> ==4176==    by 0x51E944: void sparse_solvers<double>(int, int)
> (sparse_solvers.cpp:161)
> ==4176==    by 0x4C83F1: test_sparse_solvers() (sparse_solvers.cpp:225)
> ==4176==    by 0x4C8963: main (main.h:307)
> ==4176==  Address 0x6814fc0 is 0 bytes after a block of size 16 alloc'd
> ==4176==    at 0x4C2188C: operator new[](unsigned long)
> (vg_replace_malloc.c:274)
> ==4176==    by 0x500625:
> Eigen::CompressedStorage<double>::reallocate(unsigned long)
> (CompressedStorage.h:209)
> ==4176==    by 0x500891:
> Eigen::CompressedStorage<double>::resize(unsigned long, float)
> (CompressedStorage.h:90)
> ==4176==    by 0x500938: Eigen::SparseMatrix<double,
> 0>::resizeNonZeros(int) (SparseMatrix.h:279)
> ==4176==    by 0x50631A: Eigen::SparseLDLT<Eigen::SparseMatrix<double,
> 1536>, 0>::_symbolic(Eigen::SparseMatrix<double, 1536> const&)
> (SparseLDLT.h:240)
> ==4176==    by 0x506B7C: Eigen::SparseLDLT<Eigen::SparseMatrix<double,
> 1536>, 0>::compute(Eigen::SparseMatrix<double, 1536> const&)
> (SparseLDLT.h:183)
> ==4176==    by 0x506C33: Eigen::SparseLDLT<Eigen::SparseMatrix<double,
> 1536>, 0>::SparseLDLT(Eigen::SparseMatrix<double, 1536> const&, int)
> (SparseLDLT.h:107)
> ==4176==    by 0x51E8BF: void sparse_solvers<double>(int, int)
> (sparse_solvers.cpp:159)
> ==4176==    by 0x4C83F1: test_sparse_solvers() (sparse_solvers.cpp:225)
> ==4176==    by 0x4C8963: main (main.h:307)
> ==4176==
> ==4176== Invalid read of size 4
> ==4176==    at 0x4CB942: Eigen::SparseMatrix<double,
> 0>::InnerIterator::index() const (SparseMatrix.h:434)
> ==4176==    by 0x4CE50D:
> Eigen::ei_sparse_solve_triangular_selector<Eigen::SparseTranspose<Eigen::SparseMatrix<double,
> 0> >, Eigen::Matrix<double, 33331, 1, 0, 33331, 1>, 1280, 1024,
> 1>::run(Eigen::SparseTranspose<Eigen::SparseMatrix<double, 0> > const&,
> Eigen::Matrix<double, 33331, 1, 0, 33331, 1>&) (TriangularSolver.h:82)
> ==4176==    by 0x4EF268: void
> Eigen::SparseTriangular<Eigen::SparseTranspose<Eigen::SparseMatrix<double,
> 0> >, 1280>::solveInPlace<Eigen::Matrix<double, 33331, 1, 0, 33331, 1>
>>(Eigen::MatrixBase<Eigen::Matrix<double, 33331, 1, 0, 33331, 1> >&)
> const (TriangularSolver.h:176)
> ==4176==    by 0x51110B: bool
> Eigen::SparseLDLT<Eigen::SparseMatrix<double, 1536>,
> 0>::solveInPlace<Eigen::Matrix<double, 33331, 1, 0, 33331, 1>
>>(Eigen::MatrixBase<Eigen::Matrix<double, 33331, 1, 0, 33331, 1> >&)
> const (SparseLDLT.h:341)
> ==4176==    by 0x51E944: void sparse_solvers<double>(int, int)
> (sparse_solvers.cpp:161)
> ==4176==    by 0x4C83F1: test_sparse_solvers() (sparse_solvers.cpp:225)
> ==4176==    by 0x4C8963: main (main.h:307)
> ==4176==  Address 0x6814fc0 is 0 bytes after a block of size 16 alloc'd
> ==4176==    at 0x4C2188C: operator new[](unsigned long)
> (vg_replace_malloc.c:274)
> ==4176==    by 0x500625:
> Eigen::CompressedStorage<double>::reallocate(unsigned long)
> (CompressedStorage.h:209)
> ==4176==    by 0x500891:
> Eigen::CompressedStorage<double>::resize(unsigned long, float)
> (CompressedStorage.h:90)
> ==4176==    by 0x500938: Eigen::SparseMatrix<double,
> 0>::resizeNonZeros(int) (SparseMatrix.h:279)
> ==4176==    by 0x50631A: Eigen::SparseLDLT<Eigen::SparseMatrix<double,
> 1536>, 0>::_symbolic(Eigen::SparseMatrix<double, 1536> const&)
> (SparseLDLT.h:240)
> ==4176==    by 0x506B7C: Eigen::SparseLDLT<Eigen::SparseMatrix<double,
> 1536>, 0>::compute(Eigen::SparseMatrix<double, 1536> const&)
> (SparseLDLT.h:183)
> ==4176==    by 0x506C33: Eigen::SparseLDLT<Eigen::SparseMatrix<double,
> 1536>, 0>::SparseLDLT(Eigen::SparseMatrix<double, 1536> const&, int)
> (SparseLDLT.h:107)
> ==4176==    by 0x51E8BF: void sparse_solvers<double>(int, int)
> (sparse_solvers.cpp:159)
> ==4176==    by 0x4C83F1: test_sparse_solvers() (sparse_solvers.cpp:225)
> ==4176==    by 0x4C8963: main (main.h:307)
> ==4176==
> ==4176== ERROR SUMMARY: 22 errors from 2 contexts (suppressed: 8 from 1)
> ==4176== malloc/free: in use at exit: 101,864 bytes in 33 blocks.
> ==4176== malloc/free: 671 allocs, 638 frees, 3,986,580 bytes allocated.
> ==4176== For counts of detected errors, rerun with: -v
> ==4176== searching for pointers to 33 not-freed blocks.
> ==4176== checked 250,824 bytes.
> ==4176==
> ==4176==
> ==4176== 32 bytes in 1 blocks are definitely lost in loss record 1 of 9
> ==4176==    at 0x4C2260E: malloc (vg_replace_malloc.c:207)
> ==4176==    by 0x4E6BF78: zCreate_CompCol_Matrix (in
> /usr/lib/libsuperlu.so.3.0.0)
> ==4176==    by 0x4E62F4E: zgstrf (in /usr/lib/libsuperlu.so.3.0.0)
> ==4176==    by 0x4E61ED2: zgssvx (in /usr/lib/libsuperlu.so.3.0.0)
> ==4176==    by 0x50DDB6: Eigen::SuperLU_gssvx(superlu_options_t*,
> SuperMatrix*, int*, int*, int*, char*, double*, double*, SuperMatrix*,
> SuperMatrix*, void*, int, SuperMatrix*, SuperMatrix*, double*, double*,
> double*, double*, SuperLUStat_t*, int*, std::complex<double>)
> (SuperLUSupport.h:49)
> ==4176==    by 0x50E688:
> Eigen::SparseLU<Eigen::SparseMatrix<std::complex<double>, 0>,
> 3>::compute(Eigen::SparseMatrix<std::complex<double>, 0> const&)
> (SuperLUSupport.h:396)
> ==4176==    by 0x50E7CA:
> Eigen::SparseLU<Eigen::SparseMatrix<std::complex<double>, 0>,
> 3>::SparseLU(Eigen::SparseMatrix<std::complex<double>, 0> const&, int)
> (SuperLUSupport.h:285)
> ==4176==    by 0x50F956: void sparse_solvers<std::complex<double> >(int,
> int) (sparse_solvers.cpp:187)
> ==4176==    by 0x4C84A8: test_sparse_solvers() (sparse_solvers.cpp:226)
> ==4176==    by 0x4C8963: main (main.h:307)
> ==4176==
> ==4176==
> ==4176== 56 bytes in 1 blocks are definitely lost in loss record 2 of 9
> ==4176==    at 0x4C2260E: malloc (vg_replace_malloc.c:207)
> ==4176==    by 0x4E6BCB8: zCreate_SuperNode_Matrix (in
> /usr/lib/libsuperlu.so.3.0.0)
> ==4176==    by 0x4E62F00: zgstrf (in /usr/lib/libsuperlu.so.3.0.0)
> ==4176==    by 0x4E61ED2: zgssvx (in /usr/lib/libsuperlu.so.3.0.0)
> ==4176==    by 0x50DDB6: Eigen::SuperLU_gssvx(superlu_options_t*,
> SuperMatrix*, int*, int*, int*, char*, double*, double*, SuperMatrix*,
> SuperMatrix*, void*, int, SuperMatrix*, SuperMatrix*, double*, double*,
> double*, double*, SuperLUStat_t*, int*, std::complex<double>)
> (SuperLUSupport.h:49)
> ==4176==    by 0x50E688:
> Eigen::SparseLU<Eigen::SparseMatrix<std::complex<double>, 0>,
> 3>::compute(Eigen::SparseMatrix<std::complex<double>, 0> const&)
> (SuperLUSupport.h:396)
> ==4176==    by 0x50E7CA:
> Eigen::SparseLU<Eigen::SparseMatrix<std::complex<double>, 0>,
> 3>::SparseLU(Eigen::SparseMatrix<std::complex<double>, 0> const&, int)
> (SuperLUSupport.h:285)
> ==4176==    by 0x50F956: void sparse_solvers<std::complex<double> >(int,
> int) (sparse_solvers.cpp:187)
> ==4176==    by 0x4C84A8: test_sparse_solvers() (sparse_solvers.cpp:226)
> ==4176==    by 0x4C8963: main (main.h:307)
> ==4176==
> ==4176==
> ==4176== 2,416 (112 direct, 2,304 indirect) bytes in 2 blocks are
> definitely lost in loss record 4 of 9
> ==4176==    at 0x4C2260E: malloc (vg_replace_malloc.c:207)
> ==4176==    by 0x4E4B5F8: dCreate_SuperNode_Matrix (in
> /usr/lib/libsuperlu.so.3.0.0)
> ==4176==    by 0x4E42600: dgstrf (in /usr/lib/libsuperlu.so.3.0.0)
> ==4176==    by 0x4E4160D: dgssvx (in /usr/lib/libsuperlu.so.3.0.0)
> ==4176==    by 0x511257: Eigen::SuperLU_gssvx(superlu_options_t*,
> SuperMatrix*, int*, int*, int*, char*, double*, double*, SuperMatrix*,
> SuperMatrix*, void*, int, SuperMatrix*, SuperMatrix*, double*, double*,
> double*, double*, SuperLUStat_t*, int*, double) (SuperLUSupport.h:48)
> ==4176==    by 0x511749: Eigen::SparseLU<Eigen::SparseMatrix<double, 0>,
> 3>::compute(Eigen::SparseMatrix<double, 0> const&) (SuperLUSupport.h:396)
> ==4176==    by 0x51188A: Eigen::SparseLU<Eigen::SparseMatrix<double, 0>,
> 3>::SparseLU(Eigen::SparseMatrix<double, 0> const&, int)
> (SuperLUSupport.h:285)
> ==4176==    by 0x51ECF4: void sparse_solvers<double>(int, int)
> (sparse_solvers.cpp:187)
> ==4176==    by 0x4C83F1: test_sparse_solvers() (sparse_solvers.cpp:225)
> ==4176==    by 0x4C8963: main (main.h:307)
> ==4176==
> ==4176==
> ==4176== 2,980 (64 direct, 2,916 indirect) bytes in 2 blocks are
> definitely lost in loss record 5 of 9
> ==4176==    at 0x4C2260E: malloc (vg_replace_malloc.c:207)
> ==4176==    by 0x4E4B8B8: dCreate_CompCol_Matrix (in
> /usr/lib/libsuperlu.so.3.0.0)
> ==4176==    by 0x4E4264E: dgstrf (in /usr/lib/libsuperlu.so.3.0.0)
> ==4176==    by 0x4E4160D: dgssvx (in /usr/lib/libsuperlu.so.3.0.0)
> ==4176==    by 0x511257: Eigen::SuperLU_gssvx(superlu_options_t*,
> SuperMatrix*, int*, int*, int*, char*, double*, double*, SuperMatrix*,
> SuperMatrix*, void*, int, SuperMatrix*, SuperMatrix*, double*, double*,
> double*, double*, SuperLUStat_t*, int*, double) (SuperLUSupport.h:48)
> ==4176==    by 0x511749: Eigen::SparseLU<Eigen::SparseMatrix<double, 0>,
> 3>::compute(Eigen::SparseMatrix<double, 0> const&) (SuperLUSupport.h:396)
> ==4176==    by 0x51188A: Eigen::SparseLU<Eigen::SparseMatrix<double, 0>,
> 3>::SparseLU(Eigen::SparseMatrix<double, 0> const&, int)
> (SuperLUSupport.h:285)
> ==4176==    by 0x51ECF4: void sparse_solvers<double>(int, int)
> (sparse_solvers.cpp:187)
> ==4176==    by 0x4C83F1: test_sparse_solvers() (sparse_solvers.cpp:225)
> ==4176==    by 0x4C8963: main (main.h:307)
> ==4176==
> ==4176== LEAK SUMMARY:
> ==4176==    definitely lost: 264 bytes in 6 blocks.
> ==4176==    indirectly lost: 5,220 bytes in 9 blocks.
> ==4176==      possibly lost: 0 bytes in 0 blocks.
> ==4176==    still reachable: 96,380 bytes in 18 blocks.
> ==4176==         suppressed: 0 bytes in 0 blocks.
> ==4176== Reachable blocks (those to which a pointer was found) are not
> shown.
> ==4176== To see them, rerun with: --leak-check=full --show-reachable=yes
>
> For larger matrices the indirect portion of th leaked memory increases.
>
> Cheers,
> Moritz
>
>
> (I sent this email from a wrong source address first; if you get it
> twice, I apologize for the spam)
>
> --
> Moritz Lenz
> http://perlgeek.de/ |  http://perl-6.de/ | http://sudokugarden.de/
>
>
>



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/