Re: [eigen] Uninitialised value was created by a heap allocation

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


On 14.12.2014 15:45, Billy Araujo wrote:
I have something like this:

Matrix<Real, Dynamic, 1> u;
u.resize(100);

and Valgrind gives me this error:

==11871==  Uninitialised value was created by a heap allocation

I guess you only showed part of valgrinds error message and the actual error was accessing that memory.
resize() does not initialize the storage. If you want that, write:
  u.setZero(100); (or setOnes or setConstant)


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/