On Mon, Dec 26, 2011 at 8:34 AM, Dominik Szczerba <span dir="ltr">&lt;<a href="mailto:dominik@itis.ethz.ch">dominik@itis.ethz.ch</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Sun, Dec 25, 2011 at 5:19 PM, Jed Brown &lt;<a href="mailto:jedbrown@mcs.anl.gov">jedbrown@mcs.anl.gov</a>&gt; wrote:<br>
&gt; On Sun, Dec 25, 2011 at 10:17, Dominik Szczerba &lt;<a href="mailto:dominik@itis.ethz.ch">dominik@itis.ethz.ch</a>&gt;<br>
&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; If I call a Create (or Duplicate) function on a non-Destroyed object,<br>
&gt;&gt; will be it destroyed automatically before the new allocation, or is a<br>
&gt;&gt; memory leak expected?<br>
&gt;<br>
&gt;<br>
&gt; What do you mean? Show the function call you are talking about?<br>
<br>
As simple as:<br>
<br>
Vec x<br>
VecCreate...<br>
VecCreate...<br>
exit application<br>
<br>
I would expect a leak to occur, as Matt confirmed, but was surprised<br>
that valgrind was not reporting any issues with this code, and that&#39;s<br>
why I asked my question.<br>
With valgrind option --leak-check=full (option not listed in FAQ) lost<br>
memory is reported in the first call to VecCreate, but no issue is<br>
reported due to the lack of VecDestroy. Does Petsc finalize function<br>
do some type of garbage collection?<br></blockquote><div><br></div><div>No, you will see it using -malloc_dump. Valgrind should show you overwriting the</div><div>pointer.</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">
Thanks<br>
<span class="HOEnZb"><font color="#888888">Dominik<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>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<br>