> On Jul 20, 2017, at 1:20 PM, Barry Smith <bsm...@mcs.anl.gov> wrote: > > > Let us know of specific cases that your feel violate the intended paradigm.
I was missing the fact that a Restore operation is not always needed, hence my confusion. I think that it would be helpful to flag these in the documentation. I will do my best to locate these and send in a patch Blaise > > Barry > >> On Jul 20, 2017, at 10:15 AM, Matthew Knepley <knep...@gmail.com> wrote: >> >> On Thu, Jul 20, 2017 at 9:25 AM, Blaise A Bourdin <bour...@lsu.edu> wrote: >> Hi, >> >> It’s always been my understanding that and pets object obtained by a >> XXXGetYYY had to be released with a matching XXXRestoreYYY, and that those >> created using XXXCreateYYY had to be destroyed with a YYYDestroy. >> >> It seems that this convention is getting broken in several place. I >> understand that in several situations, this is because the XXXRestoreYYY >> would essentially do nothing. >> >> Is it safe to assume that if a function XXXGetYYY does not have a matching >> XXXRestoreYYY, the instance of PetscYYY does not have to be destroyed in any >> way? >> >> Yes. We use Get in two ways: >> >> 1) Get a borrowed reference. Then nothing has to be done >> >> 2) Get a reference which need extra processing. This requires a matching >> Restore >> >> Is it safe to assume that any instance of a PetscYYY created from >> XXXCreateYYY can be safely destroyed with a YYYDestroy without side effects? >> >> Yes. >> >> If so, should the offending functions be renamed or should something be >> explicitly added to their man page? >> >> We try to always have the matching restore on the manpage. If it is not, we >> should fix it. >> >> Thanks, >> >> Matt >> >> >> Blaise >> >> -- >> Department of Mathematics and Center for Computation & Technology >> Louisiana State University, Baton Rouge, LA 70803, USA >> Tel. +1 (225) 578 1612, Fax +1 (225) 578 4276 >> http://www.math.lsu.edu/~bourdin >> >> >> >> >> >> >> >> >> >> >> -- >> 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 >> >> http://www.caam.rice.edu/~mk51/ > -- Department of Mathematics and Center for Computation & Technology Louisiana State University, Baton Rouge, LA 70803, USA Tel. +1 (225) 578 1612, Fax +1 (225) 578 4276 http://www.math.lsu.edu/~bourdin