[petsc-dev] memory leak
Barry Smith
bsmith at mcs.anl.gov
Sun May 31 21:24:06 CDT 2015
Thanks. This is our bug, the custom Fortran stub did not free the array of subksp.
I have fixed in master and next
Barry
> On May 31, 2015, at 9:02 PM, Mark Adams <mfadams at lbl.gov> wrote:
>
> This is coming from this line (last):
>
> #undef __FUNCT__
> #define __FUNCT__ "PCFieldSplitGetSubKSP_FieldSplit_Schur"
> static PetscErrorCode PCFieldSplitGetSubKSP_FieldSplit_Schur(PC pc,PetscInt *n,KSP **subksp)
> {
> PC_FieldSplit *jac = (PC_FieldSplit*)pc->data;
> PetscErrorCode ierr;
>
> PetscFunctionBegin;
> ierr = PetscMalloc1(jac->nsplits,subksp);CHKERRQ(ierr);
>
> I call it with:
>
> KSP::subksp(2)
> ....
> call PCFieldSplitGetSubKSP(solver%pc,PETSC_NULL_INTEGER,subksp,ierr)
>
> The Fortran wrapper is:
>
> PETSC_EXTERN void PETSC_STDCALL pcfieldsplitgetsubksp_(PC *pc,PetscInt *n_local,KSP *ksp,PetscErrorCode *ierr)
> {
> KSP *tksp;
> PetscInt i,nloc;
> CHKFORTRANNULLINTEGER(n_local);
> *ierr = PCFieldSplitGetSubKSP(*pc,&nloc,&tksp); if (*ierr) return;
> if (n_local) *n_local = nloc;
> CHKFORTRANNULLOBJECT(ksp);
> if (ksp) {
> for (i=0; i<nloc; i++) ksp[i] = tksp[i];
> }
> }
>
> Should I just add a PetscFree(&tksp) here?
>
>
>
> On Sun, May 31, 2015 at 7:24 PM, Mark Adams <mfadams at lbl.gov> wrote:
>
>
> On Sat, May 30, 2015 at 10:51 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> Need more details. How can we reproduce this?
>
> I was hoping this would be obvious. a missed free.
>
> What tests use Schur solvers? I could see if they have the same problem.
>
>
> Barry
>
> > On May 30, 2015, at 7:10 PM, Mark Adams <mfadams at lbl.gov> wrote:
> >
> > This look like there might be a memory leak in PETSc. Let me know if this is not obvious and get more detail.
> > Mark
> >
> > [0]Total space allocated 16 bytes
> > [ 0]16 bytes PCFieldSplitGetSubKSP_FieldSplit_Schur() line 1263 in /global/u2/m/madams/petsc/src/ksp/pc/impls/fieldsplit/fieldsplit.c
> > [0] PCFieldSplitGetSubKSP_FieldSplit_Schur() line 1263 in /global/u2/m/madams/petsc/src/ksp/pc/impls/fieldsplit/fieldsplit.c
> > [0] PCFieldSplitGetSubKSP() line 1665 in /global/u2/m/madams/petsc/src/ksp/pc/impls/fieldsplit/fieldsplit.c
> > [0] KSPSetUp() line 247 in /global/u2/m/madams/petsc/src/ksp/ksp/interface/itfunc.c
> >
>
>
>
More information about the petsc-dev
mailing list