|[eigen] tracking memory usage?|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] tracking memory usage?
- From: David Roundy <roundyd@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 13 Sep 2010 10:55:35 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=OC3Oc92AB/kwbEj32Ez5usqS6VeMjW1ISlDcF546ySQ=; b=a4FJg2DiyYLih6Gu+eRBlXkysv+rHP88JY1lXZ8fA2HXot35y/9BA3LimgZXHf2VuU W3FdOL2hILZvfK9v+b9pl9Lf8WbEAp/ybFaA1h+YBAQMSEogjEfbes+kPBrmd93KnwXH Uu76mm3KN7ZSNO7jn3gS73OsoAKDEhpvpJC1U=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=hc0c48SZT4QxLGFAwmiJOn4I96kzrZjnbS1XmLXuBuTKfp5OSuV5MqgWsZhbajadEX QhcJG+NXEp8JKn+CzgebS2lMTK5jbeHvlQ4xszK0Z43heSo5Jyy+lxOK+aneGRmhkc+N e+KT6spcRenx1errKpOWsKXA8cT1EgOfeEroM=
I've written a program using eigen2, without paying too much attention
either to time or space efficiency. I'm now confident that the
program is correct (so far... but it's not complete), and am looking
to refactor it to reduce memory consumption.
Ordinarily in C++ I would figure out where the memory is going by
instrumenting the constructors and destructors of large data types to
track net memory use and log it (and log who allocated it). I can do
the same thing with some of my code in this case (since I derive a
subclass of VectorXd), but that won't count any actual VectorXds that
get allocated directly.
My primary approach I expect to be switching functions that currently
accept (const VectorXd &) to accept instead somthing like (const
Eigen::MatrixBase <OtherDerived>&) to enable lazy evaluation of
expressions. My understanding is that creating functions that
*return* a lazily evaluated vector is tricky...
Any suggestions or hints, of approaches that work effectively in
improving memory use in eigen2 programs? (Or if it'd be worth
switching to eigen3?)
Thanks for the great package!