[Trilinos-Users] [EXTERNAL] Epetra_FECrsMatrix memory issues?

Nico Schlömer nico.schloemer at gmail.com
Wed Jul 4 01:23:53 MDT 2012

I think I now see what the issue is.
Epetra_FECrsMatrix::InputNonlocalValue() contains a number of
std::vector<double>::insert() statements working on class variables,
effectively extending the vectors every time this method is called.
This becomes an issue if the same matrix is filled a number of times
(as is the case with my application).
I'm not sure about why one sees the large memory allocation in the
std::vector<>::iterator after all, but this has been observed before
It looks very much like this has been introduced in
72ed0256d81640b7374e5da028900daca9a86016 last February.

grep "insert(" ./packages/epetra/src/
shows that there are a number of other calls to insert in methods
which may be called a couple of times in a row, so those will probably
need to be checked.


On Wed, Jul 4, 2012 at 12:27 AM, Nico Schlömer <nico.schloemer at gmail.com> wrote:
> Alright so Jeremie's leak fix in Epetra_CrsMatrix earlier this week
> does *not* address the issue.
> Looking at the output of Valgrind's massif, it seems that the culprit is
> 0x88769C: std::vector<double, std::allocator<double>
> std::vector<double, std::allocator<double> > >, double const&)
> 36.7 MB
> in Epetra_FECrsMatrix::InputNonlocalValue. -- An iterator, really?
> --Nico
> On Tue, Jul 3, 2012 at 9:26 PM, Williams, Alan B <william at sandia.gov> wrote:
>> Sounds like a leak. I'll look into it.
>> Alan
>> ----- Original Message -----
>> From: Nico Schlömer [mailto:nico.schloemer at gmail.com]
>> Sent: Tuesday, July 03, 2012 01:07 PM
>> To: trilinos-users at software.sandia.gov <trilinos-users at software.sandia.gov>
>> Subject: [EXTERNAL] [Trilinos-Users] Epetra_FECrsMatrix memory issues?
>> Hi all,
>> I recently discovered that, for large-scale problems, my (LOCA-based)
>> application code consumes more and more memory as the computation goes
>> along, eventually resulting in an ungraceful exit of it all. I now did
>> a memory profile of the code and, surprisingly, a large chunk of the
>> memory that is consumed are "std::vectors", supposedly allocated by
>> Epetra_FECrsMatrix::InputNonlocalValue().
>> The design of the code is such that there is an Epetra_FECrsMatrix
>> factory with a cache of one matrix (all of the matrices in my code
>> have the same graph). Upon calling the giveMeAMatrix() for this
>> factory, the cache gets (conditionally) recreated and is subsequently
>> copied out. It seems that this recalculate process eats more memory as
>> more and more matrices are computed.
>> I put up a memory profile for anyone to look at
>> <http://win.ua.ac.be/~nschloe/other/massif.out.3902>, e.g., using the
>> massif-visualizer (screen shot of my application view here
>> <http://win.ua.ac.be/~nschloe/other/massif-vis.png>).
>> Anyone with similar issues here, or an idea for a remedy?
>> Cheers,
>> Nico
>> _______________________________________________
>> Trilinos-Users mailing list
>> Trilinos-Users at software.sandia.gov
>> http://software.sandia.gov/mailman/listinfo/trilinos-users

More information about the Trilinos-Users mailing list