[petsc-dev] apparent memory leak

Jed Brown jed at jedbrown.org
Thu Aug 21 23:37:38 CDT 2014


Mark Adams <mfadams at lbl.gov> writes:

> I have been getting this memory leak message.  I am calling this from
> fortran.  I've looked at the code and it is not obvious where this comes
> from.
>
> Mark
>
> [30]Total space allocated 16 bytes
> [30]16 bytes PCFieldSplitGetSubKSP_FieldSplit_Schur() line 1233 in
> /global/u2/m/madams/petsc_private/src/ksp/pc/impls/fieldsplit/fieldsplit.c

Looks like Barry forget to free the array that was allocated:

diff --git i/src/ksp/pc/impls/fieldsplit/ftn-custom/zfieldsplitf.c w/src/ksp/pc/impls/fieldsplit/ftn-custom/zfieldsplitf.c
index f3bda29..ec0225e 100644
--- i/src/ksp/pc/impls/fieldsplit/ftn-custom/zfieldsplitf.c
+++ w/src/ksp/pc/impls/fieldsplit/ftn-custom/zfieldsplitf.c
@@ -18,5 +18,6 @@ PETSC_EXTERN void PETSC_STDCALL pcfieldsplitgetsubksp_(PC *pc,PetscInt *n_local,
   if (ksp) {
     for (i=0; i<nloc; i++) ksp[i] = tksp[i];
   }
+  *ierr =  PetscFree(tksp);
 }
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20140821/10f3e70a/attachment.sig>


More information about the petsc-dev mailing list