VecDestroy and memory leak

Jed Brown jed at 59A2.org
Sat Nov 28 07:23:31 CST 2009


On Sat, 28 Nov 2009 10:18:04 +0100, nicolas aunai <nicolas.aunai at gmail.com> wrote:
> I've looked at the function VecDestroy() definition, it seems to check
> a PetscObject member called 'refct' before actually free the memory,
> I've printed this 'refct' for my natural vector and its value is '2',
> while it is '1' for a vector correctly freed.

The DA holds a reference to this vector so it can give it away the next
time you call DACreateNaturalVector().  It's not a leak because the DA
will destroy it's reference in DADestroy().  You can run with
-malloc_dump to confirm that all PETSc objects have been destroyed.

Jed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20091128/42a1e73d/attachment.pgp>


More information about the petsc-users mailing list