<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jul 20, 2017 at 9:25 AM, Blaise A Bourdin <span dir="ltr"><<a href="mailto:bourdin@lsu.edu" target="_blank">bourdin@lsu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
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.<br>
<br>
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.<br>
<br>
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?<br>
</blockquote><div><br></div><div>Yes. We use Get in two ways:</div><div><br></div><div>  1) Get a borrowed reference. Then nothing has to be done</div><div><br></div><div>  2) Get a reference which need extra processing. This requires a matching Restore</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Is it safe to assume that any instance of a PetscYYY created from XXXCreateYYY can be safely destroyed with a YYYDestroy without side effects?<br></blockquote><div><br></div><div>Yes.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
If so, should the offending functions be renamed or should something be explicitly added to their man page?</blockquote><div><br></div><div>We try to always have the matching restore on the manpage. If it is not, we should fix it.</div><div><br></div><div>  Thanks,</div><div><br></div><div>    Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888"><br>
Blaise<br>
<br>
--<br>
Department of Mathematics and Center for Computation & Technology<br>
Louisiana State University, Baton Rouge, LA 70803, USA<br>
Tel. <a href="tel:%2B1%20%28225%29%20578%201612" value="+12255781612">+1 (225) 578 1612</a>, Fax  <a href="tel:%2B1%20%28225%29%20578%204276" value="+12255784276">+1 (225) 578 4276</a> <a href="http://www.math.lsu.edu/~bourdin" rel="noreferrer" target="_blank">http://www.math.lsu.edu/~<wbr>bourdin</a><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.caam.rice.edu/~mk51/" target="_blank">http://www.caam.rice.edu/~mk51/</a><br></div></div></div>
</div></div>