Re: [eigen] Eigen SPQR support memory leak

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


Thanks for the report.
It is now fixed in the devel branch
https://bitbucket.org/eigen/eigen/commits/dc649357a07f/
Changeset:   dc649357a07f
User:        dnuentsa
Date:        2013-05-13 13:04:12
Summary:     fix memory leak from Cholmod data in SPQR support
Affected #:  1 file

Nuentsa W.

On 05/03/2013 06:52 PM, Xin Zhao wrote:
Dear all,

I am using SPQR support in Eigen3.20-beta1. And unfortunately I got some memory leak.

I tried Valgrind and got the flollowing error.

1,176 bytes in 1 blocks are possibly lost in loss record 13,376 of 14,289
  in TangentProjection2::Projection() in elastic/projection2.cpp:904
  1: realloc in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so
  2: cholmod_l_realloc in /home/nullas/workspace/build-PetGL-Debug/libelastic.so
  3: cholmod_l_realloc_multiple in /home/nullas/workspace/build-PetGL-Debug/libelastic.so
  4: cholmod_l_reallocate_sparse in /home/nullas/workspace/build-PetGL-Debug/libelastic.so
  5: long SuiteSparseQR<double>(int, double, long, int, cholmod_sparse_struct*, cholmod_sparse_struct*, cholmod_dense_struct*, cholmod_sparse_struct**, cholmod_dense_struct**, cholmod_sparse_struct**, long**, cholmod_sparse_struct**, long**, cholmod_dense_struct**, cholmod_common_struct*) in /home/nullas/workspace/build-PetGL-Debug/libelastic.so
  6: long SuiteSparseQR<double>(int, double, long, cholmod_sparse_struct*, cholmod_sparse_struct**, long**, cholmod_sparse_struct**, long**, cholmod_dense_struct**, cholmod_common_struct*) in /home/nullas/workspace/build-PetGL-Debug/libelastic.so
  7: Eigen::SPQR&lt;Eigen::SparseMatrix&lt;double, 0, int&gt; &gt;::compute(Eigen::SparseMatrix&lt;double, 0, int&gt; const&amp;) in <a href="" class="moz-txt-link-rfc2396E" href="file:///usr/local/include/eigen3/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h:98">"file:///usr/local/include/eigen3/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h:98" >/usr/local/include/eigen3/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h:98</a>
  8: Eigen::SPQR&lt;Eigen::SparseMatrix&lt;double, 0, int&gt; &gt;::SPQR(Eigen::SparseMatrix&lt;double, 0, int&gt; const&amp;) in <a href="" class="moz-txt-link-rfc2396E" href="file:///usr/local/include/eigen3/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h:80">"file:///usr/local/include/eigen3/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h:80" >/usr/local/include/eigen3/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h:80</a>
  9: TangentProjection2::Projection() in <a href="" class="moz-txt-link-rfc2396E" href="file:///home/nullas/workspace/build-PetGL-Debug/elastic/../../PetGL/elastic/projection2.cpp:904">"file:///home/nullas/workspace/build-PetGL-Debug/elastic/../../PetGL/elastic/projection2.cpp:904" >elastic/projection2.cpp:904</a>
  10: TangentProjection2::Next() in <a href="" class="moz-txt-link-rfc2396E" href="file:///home/nullas/workspace/build-PetGL-Debug/elastic/../../PetGL/elastic/projection2.cpp:310">"file:///home/nullas/workspace/build-PetGL-Debug/elastic/../../PetGL/elastic/projection2.cpp:310" >elastic/projection2.cpp:310</a>
  11: ProjectionThreading2::run() in <a href="" class="moz-txt-link-rfc2396E" href="file:///home/nullas/workspace/build-PetGL-Debug/elastic/../../PetGL/elastic/projection2_thread.cpp:113">"file:///home/nullas/workspace/build-PetGL-Debug/elastic/../../PetGL/elastic/projection2_thread.cpp:113" >elastic/projection2_thread.cpp:113</a>
  12: /usr/lib/libQtCore.so.4.8.4
  13: start_thread in /usr/lib/libpthread-2.17.so
  14: clone in /usr/lib/libc-2.17.so


Here is a code how I use SPQR
some function
{
// try to solve F^T*F x = b 
G = F.transpose() * F; // F is not guaranteed to be full rank.
Eigen::SPQR<SparseMatrix<double> > solver(G);
x = G.solve(b)


Since my application use this batch of code at each iteration, it will crash after a while.
Is it the way I call SPQR is wrong?

Thank you for time.

Best,
Xin


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