[petsc-users] free unused allocated nonzeros after overestimating preallocation
Matthew Knepley
knepley at gmail.com
Mon May 3 08:45:59 CDT 2010
On Mon, May 3, 2010 at 8:40 AM, Jed Brown <jed at 59a2.org> wrote:
> On Mon, 3 May 2010 08:20:44 -0500, Matthew Knepley <knepley at gmail.com>
> wrote:
> > MatAssemblyBegin/End() frees the unused memory, so you must be
> > calculating the amount of memory needed incorrectly.
>
> It compacts the values but does not free the extra memory. It would be
> easy to add a matrix option to allocate new space for the entries and
> column indices, then copy the entries over, but requires too much memory
> to do it by default.
>
Yep, does not free by default, which would mean making a copy.
> MatDuplicate on the other hand only allocates for the used values, but
> copies the "maxnz" field so it will incorrectly report more allocation
> than there really is.
I can fix this.
Matt
>
> Jed
>
--
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20100503/150fc057/attachment.htm>
More information about the petsc-users
mailing list