Re: [eigen] Memory leaks

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


Am 14.04.2015 um 16:06 schrieb Mathieu Dutour:
I obtain the leak by writing
MyVector<T> V1=eMat.row(iRow);

I eliminate the leak by doing
MyVector<T> V1(nbCol);
V1=eMat.row(iRow);

I can confirm this, the problem is in the constructor of Matrix:
    EIGEN_STRONG_INLINE Matrix(const MatrixBase<OtherDerived>& other)
             : Base(other.rows() * other.cols(), other.rows(), other.cols())

here Base is called with rows and cols of `other`, even though `other` needs to be transposed. Base then does not assert that cols==1.

Is there a reason to call Base(size, rows, cols) at all? The call to
  Base::_set_noalias(other);
should do all appropriate resizing, does it not?

I've removed that line and my test-case passes now. I'm running the test-suite now to see if this has any unforeseen side-effects.

Christoph





--
----------------------------------------------
Dipl.-Inf., Dipl.-Math. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: +49 (421) 218-64252
----------------------------------------------



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