[petsc-users] Using -malloc_dump to examine memory leak

Mark Adams mfadams at lbl.gov
Tue Apr 16 03:04:02 CDT 2019


Use valgrind with --leak-check=yes

This should give a stack trace at the end of the run.

On Tue, Apr 16, 2019 at 2:14 AM Yuyun Yang via petsc-users <
petsc-users at mcs.anl.gov> wrote:

> Hello team,
>
>
>
> 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:
>
>
>
> [ 0]1520 bytes VecCreate() line 35 in
> /home/yyy910805/petsc/src/vec/vec/interface/veccreate.c
>
>       [0]  PetscMallocA() line 35 in
> /home/yyy910805/petsc/src/sys/memory/mal.c
>
>       [0]  VecCreate() line 30 in
> /home/yyy910805/petsc/src/vec/vec/interface/veccreate.c
>
>       [0]  VecDuplicate_Seq() line 804 in
> /home/yyy910805/petsc/src/vec/vec/impls/seq/bvec2.c
>
>       [0]  VecDuplicate() line 375 in
> /home/yyy910805/petsc/src/vec/vec/interface/vector.c
>
>
>
> 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?).
>
>
>
> How can I use this option to debug effectively?
>
>
>
> Thanks a lot,
>
> Yuyun
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190416/cc25c8ec/attachment.html>


More information about the petsc-users mailing list