<div dir="ltr"><div dir="ltr">Use valgrind with --leak-check=yes</div><div dir="ltr"><br></div><div>This should give a stack trace at the end of the run.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 16, 2019 at 2:14 AM Yuyun Yang via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-US">
<div class="gmail-m_-7178337777557711657WordSection1">
<p class="MsoNormal">Hello team,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I’m trying to use the options -malloc_dump and -malloc_debug to examine memory leaks. The messages however, are quite generic, and don’t really tell me where the problems occur, for example:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">[ 0]1520 bytes VecCreate() line 35 in /home/yyy910805/petsc/src/vec/vec/interface/veccreate.c<u></u><u></u></p>
<p class="MsoNormal"> [0] PetscMallocA() line 35 in /home/yyy910805/petsc/src/sys/memory/mal.c<u></u><u></u></p>
<p class="MsoNormal"> [0] VecCreate() line 30 in /home/yyy910805/petsc/src/vec/vec/interface/veccreate.c<u></u><u></u></p>
<p class="MsoNormal"> [0] VecDuplicate_Seq() line 804 in /home/yyy910805/petsc/src/vec/vec/impls/seq/bvec2.c<u></u><u></u></p>
<p class="MsoNormal"> [0] VecDuplicate() line 375 in /home/yyy910805/petsc/src/vec/vec/interface/vector.c<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">The code is huge, so going through every single VecCreate/VecDuplicate and VecDestroy is going to be time-consuming. Meanwhile, running valgrind gave me some uninitialized values errors that don’t seem to be related to the above message
(or maybe they are?).<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">How can I use this option to debug effectively?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks a lot,<u></u><u></u></p>
<p class="MsoNormal">Yuyun<u></u><u></u></p>
</div>
</div>
</blockquote></div>