Re: [eigen] Memory leaks

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




On Wed, Apr 15, 2015 at 3:55 PM, Christoph Hertzberg <chtz@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Am 15.04.2015 um 14:04 schrieb Gael Guennebaud:
On Wed, Apr 15, 2015 at 11:14 AM, Christoph Hertzberg <
chtz@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
While the test-suite ran without (new) failures, I found a possible reason
for calling the Base constructor. When compiling with
   EIGEN_NO_AUTOMATIC_RESIZING
the Base::_set_noalias(other) call would assert (which it should not for
the constructor). Adding a call to resizeLike(other) -- not
_resize_to_match -- should do the job.

yes, we could call resizeLike either from the ctor or _set_noalias making
sure that _set_noalias will always be called from ctors only.

IMO, the first makes more sense.

me too, but it was ambiguous from your initial suggestion.
 
Two other things:
The ReturnByValue constructor does not implicitly transpose the result if
required, is this intended? Implementing this would require a few lines of
additional code in the assignment logic.

hm, have to check first whether operator=(ReturnByValue) does implicit
transposition without extra copy.

Actually most uses of ReturnByValue have been replaced during the Evaluator refactorings. E.g.,
  TriangularViewImpl<Derived,Mode,Dense>::solve
is now overwritten by
  TriangularView<MatrixType, _Mode>::solve
and returns a Solve object instead of a ReturnByValue

But see:
  Matrix3d M = Matrix3d::Random();
  Vector3d x;
  // works:
  x.transpose() = M.triangularView<Upper>().solve(M.col(0));
  x.transpose() = M.triangularView<Upper>().solve<OnTheRight>(M.row(0));
  // asserts:
  x = M.triangularView<Upper>().solve<OnTheRight>(M.row(0));

I assume the remaining ReturnByValues should actually also be replaced by corresponding Evaluator expressions?
Then the question is if we need to keep ReturnByValue, in case it is used by user-code.

 ReturnByValue should be kept for user code only and removed everywhere else, so let's not bother too much about ReturnByValue.

gael



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