<p>Ok these answer my question. Many thanks!</p>
<div class="gmail_quote">On Oct 2, 2011 6:07 PM, "Barry Smith" <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br type="attribution">> <br>> On Oct 2, 2011, at 10:35 AM, Jed Brown wrote:<br>
> <br>>> On Sun, Oct 2, 2011 at 04:46, Dominik Szczerba <<a href="mailto:dominik@itis.ethz.ch">dominik@itis.ethz.ch</a>> wrote:<br>>> if(object)<br>>> KSP/Mat/Vec/etcDestroy(object)<br>>> <br>
>> Just call KSPDestroy(&ksp);<br>>> <br>>> It doesn't matter if KSP is NULL or a valid object because this function checks. But note that if you just write<br>>> <br>>> KSP ksp;<br>>> <br>
>> or allocate similarly in part of malloc() --- with no memzero() or similar --- then the value of ksp is undefined.<br>> <br>> <br>> In other words, if you are sometimes not sure if you will ever create a certain object make sure you initialize it to 0 with<br>
> <br>> Vec vec = 0;<br>> <br>> .......<br>> <br>> <br>> VecDestroy(&vec);<br>> <br>> .....<br>> <br>> <br>> Note that we pass &vec as the argument and all the destroys set the value to 0 so it cannot be accidently used again.<br>
> <br>> Barry<br>> <br>> <br>> <br></div>