VecDestroy and memory leak

Jed Brown jed at
Sat Nov 28 09:27:34 CST 2009

On Sat, 28 Nov 2009 15:44:19 +0100, nicolas aunai <nicolas.aunai at> wrote:
> VecCreateSeq(PETSC_COMM_SELF, mx*my*dof, &ssol);
> VecScatterCreateToAll(nsol, &ctx, &ssol);

This is a new vector, the one you create on the line above is lost.
From the man page:

|     Do NOT create a vector and then pass it in as the final argument vout! vout is created by this routine
|   automatically (unless you pass PETSC_NULL in for that argument if you do not need it).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <>

More information about the petsc-users mailing list