[petsc-dev] memory leak

Matthew Knepley knepley at gmail.com
Mon Jun 1 07:17:57 CDT 2015


On Mon, Jun 1, 2015 at 7:16 AM, Mark Adams <mfadams at lbl.gov> wrote:

> On Mon, Jun 1, 2015 at 8:05 AM, Matthew Knepley <knepley at gmail.com> wrote:
>
>> On Sun, May 31, 2015 at 9:20 PM, Mark Adams <mfadams at lbl.gov> wrote:
>>
>>> I have asked this question before but I still do not understand what git
>>> is doing here.
>>>
>>> I pulled, made a fix, did a git status, and I see that I am 7 commits
>>> ahead of master.  I commit and I am 8 commits ahead of master.  What are
>>> these commits?  I have not pulled
>>>
>>
>> Lets just start with this. If you branch from master, you will not be ANY
>> commits ahead:
>>
>>   git checkout master
>>   git pull
>>   git checkout -b knepley/fix-shit
>>
>> It sounds like you are creating the branch from a local master that is
>> behind.
>>
>>
> I don't understand.  I am _on_ master. I also did a fresh clone last
> week.  I did a git log and I see normal stuff like Barry's fix for
> GetSubMatrix.  I have been going back and forth to maint.  Perhaps I pulled
> from maint into my master by mistake?
>

Right before you make the branch from master, you should pull. If you pull,
you will be 0 commits ahead.

   Matt


> Thanks,
> Mark
>
>
>>    Matt
>>
>>
>>> from another branch, at least I did not knowingly.  I am tempted to just
>>> start with a fresh clone and redo this whole thing.
>>>
>>> What is going on here?  Did I sleep walk last night and pull from next?
>>>
>>> Can I just push this to master (I tested it and it is a trivial change)
>>> or should I reclone. etc.?
>>>
>>> Mark
>>>
>>> 19:10 edison03 master ~/petsc$ git status
>>> # On branch master
>>> # Your branch is ahead of 'origin/master' by 7 commits.
>>> #
>>> # Changes not staged for commit:
>>> #   (use "git add <file>..." to update what will be committed)
>>> #   (use "git checkout -- <file>..." to discard changes in working
>>> directory)
>>> #
>>> #       modified:   src/ksp/pc/impls/fieldsplit/ftn-custom/zfieldsplitf.c
>>> #
>>> no changes added to commit (use "git add" and/or "git commit -a")
>>> 19:10 edison03 master ~/petsc$ git commit
>>> src/ksp/pc/impls/fieldsplit/ftn-custom/zfieldsplitf.c -m"fixed memory leak"
>>> [master d4dcd7b] fixed memory leak
>>>  1 file changed, 1 insertion(+)
>>> 19:10 edison03 master ~/petsc$ git pull origin master
>>> From https://bitbucket.org/petsc/petsc
>>>  * branch            master     -> FETCH_HEAD
>>> Already up-to-date.
>>> 19:11 edison03 master ~/petsc$ git status
>>> # On branch master
>>> # Your branch is ahead of 'origin/master' by 8 commits.
>>> #
>>> nothing to commit (working directory clean)
>>> 19:11 edison03 master ~/petsc$
>>>
>>>
>>> On Sun, May 31, 2015 at 10: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
>>>>>> >
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>>
>> --
>> 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
>>
>
>


-- 
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-dev/attachments/20150601/a1684c24/attachment.html>


More information about the petsc-dev mailing list