Re: [eigen] Memory leaks

[ Thread Index | Date Index | More Archives ]

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
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.

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.,
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.

The constructors of Array and Matrix are almost identical, [...]

I don't see pitfalls, so the lesser number of boilerplate code, the better

Ok, I'll be working on this.


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+