[petsc-dev] Get/Restore vs Create/Destroy

Blaise A Bourdin bourdin at lsu.edu
Thu Jul 20 08:25:55 CDT 2017


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?
Is it safe to assume that any instance of a PetscYYY created from XXXCreateYYY can be safely destroyed with a YYYDestroy without side effects?

If so, should the offending functions be renamed or should something be explicitly added to their man page?


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

More information about the petsc-dev mailing list