> On 17 Oct 2017, at 15:47, Jed Brown <[email protected]> wrote:
> 
>> c.f. also the petsc-maint discussion last October in the thread:
>> 
>> "Segfault when DM is reused in two SNESes with multigrid"
> 
> What should I do?  That thread petered out when nobody could suggest a
> criteria to distinguish reuse of a DM in related SNES objects (e.g.,
> nonlinear preconditioning or nonlinear multigrid) from reuse with intent
> to solve different problems.

So my initial concern was that if I do:

SNESSetDM(snes, dm);
SNESSolve(snes);
SNESDestroy(&snes);

Then dm still has stale pointers to snes (in the context of the restrict hook). 
 These aren't cleaned up until DMDestroy.  It was surprising to me that 
SNESDestroy did not clean up all the things that SNESCreate/Solve set up.

I don't care about the case of:

SNESSetDM(snes1, dm);
SNESSetDM(snes2, dm);

I work around this issue by making new DMs, so it's OK if nothing changes in 
PETSc.  

Lawrence

Reply via email to