UnitSquareMesh memory leak

Asked by Miro

Hi,

I get memory leaks when running the following code through valgrind:

#include <dolfin.h>

using namespace dolfin;

int main()
{
    const unsigned int N = 2;
    UnitSquareMesh mesh(N, N);

    return 0;
}

Here's a copy of the message:

==4356== Memcheck, a memory error detector
==4356== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==4356== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==4356== Command: ./bmp
==4356==
--4356-- WARNING: Serious error when reading debug info
--4356-- When reading debug info from /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2:
--4356-- Can't make sense of .got section mapping
--4356-- WARNING: Serious error when reading debug info
--4356-- When reading debug info from /usr/lib/i386-linux-gnu/libglapi.so.0.0.0:
--4356-- Can't make sense of .got section mapping
==4356== Syscall param sched_setaffinity(mask) points to unaddressable byte(s)
==4356== at 0x4E0EE77: syscall (syscall.S:31)
==4356== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==4356==
==4356== Syscall param writev(vector[...]) points to uninitialised byte(s)
==4356== at 0x4E0AC1E: writev (writev.c:51)
==4356== Address 0xf8e84ab is 83 bytes inside a block of size 256 alloc'd
==4356== at 0x402CF52: realloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==4356== by 0x9C99BF5: ??? (in /usr/lib/openmpi/lib/libopen-pal.so.0.0.0)
==4356== by 0x9C9A971: ??? (in /usr/lib/openmpi/lib/libopen-pal.so.0.0.0)
==4356== by 0xF206936: ??? (in /usr/lib/openmpi/lib/openmpi/mca_grpcomm_bad.so)
==4356== by 0xF205E7B: ??? (in /usr/lib/openmpi/lib/openmpi/mca_grpcomm_bad.so)
==4356== by 0x678EC07: ??? (in /usr/lib/openmpi/lib/libmpi.so.0.0.2)
==4356== by 0x67B11FD: PMPI_Init_thread (in /usr/lib/openmpi/lib/libmpi.so.0.0.2)
==4356== by 0x4447D2D: dolfin::SubSystemsManager::init_mpi(int, char**, int) (SubSystemsManager.cpp:105)
==4356== by 0x6A5290F6: ???
==4356==
==4356==
==4356== HEAP SUMMARY:
==4356== in use at exit: 216,904 bytes in 2,762 blocks
==4356== total heap usage: 15,363 allocs, 12,601 frees, 16,730,239 bytes allocated
==4356==
==4356== LEAK SUMMARY:
==4356== definitely lost: 3,571 bytes in 56 blocks
==4356== indirectly lost: 2,222 bytes in 32 blocks
==4356== possibly lost: 0 bytes in 0 blocks
==4356== still reachable: 211,111 bytes in 2,674 blocks
==4356== suppressed: 0 bytes in 0 blocks
==4356== Rerun with --leak-check=full to see details of leaked memory
==4356==
==4356== For counts of detected and suppressed errors, rerun with: -v
==4356== Use --track-origins=yes to see where uninitialised values come from
==4356== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Johan Hake
Solved:
Last query:
Last reply:
Revision history for this message
Best Johan Hake (johan-hake) said :
#1

There are no mentioning of UnitSquareMesh in the leak report. Only from
MPI, which easily can be false positive reports. MPI does a lot fancy
stuff behind the scenes which valgrind can interpret as leaks. One can
compile a file with these false reports and put them in so called
suppress files. Hand this file to the valgrind command using --suppress
FILE and you will get rid of that message.

Johan

On 03/15/2013 09:11 AM, Miro wrote:
> New question #224353 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/224353
>
> Hi,
>
> I get memory leaks when running the following code through valgrind:
>
> #include <dolfin.h>
>
> using namespace dolfin;
>
> int main()
> {
> const unsigned int N = 2;
> UnitSquareMesh mesh(N, N);
>
> return 0;
> }
>
> Here's a copy of the message:
>
> ==4356== Memcheck, a memory error detector
> ==4356== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
> ==4356== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
> ==4356== Command: ./bmp
> ==4356==
> --4356-- WARNING: Serious error when reading debug info
> --4356-- When reading debug info from /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2:
> --4356-- Can't make sense of .got section mapping
> --4356-- WARNING: Serious error when reading debug info
> --4356-- When reading debug info from /usr/lib/i386-linux-gnu/libglapi.so.0.0.0:
> --4356-- Can't make sense of .got section mapping
> ==4356== Syscall param sched_setaffinity(mask) points to unaddressable byte(s)
> ==4356== at 0x4E0EE77: syscall (syscall.S:31)
> ==4356== Address 0x0 is not stack'd, malloc'd or (recently) free'd
> ==4356==
> ==4356== Syscall param writev(vector[...]) points to uninitialised byte(s)
> ==4356== at 0x4E0AC1E: writev (writev.c:51)
> ==4356== Address 0xf8e84ab is 83 bytes inside a block of size 256 alloc'd
> ==4356== at 0x402CF52: realloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
> ==4356== by 0x9C99BF5: ??? (in /usr/lib/openmpi/lib/libopen-pal.so.0.0.0)
> ==4356== by 0x9C9A971: ??? (in /usr/lib/openmpi/lib/libopen-pal.so.0.0.0)
> ==4356== by 0xF206936: ??? (in /usr/lib/openmpi/lib/openmpi/mca_grpcomm_bad.so)
> ==4356== by 0xF205E7B: ??? (in /usr/lib/openmpi/lib/openmpi/mca_grpcomm_bad.so)
> ==4356== by 0x678EC07: ??? (in /usr/lib/openmpi/lib/libmpi.so.0.0.2)
> ==4356== by 0x67B11FD: PMPI_Init_thread (in /usr/lib/openmpi/lib/libmpi.so.0.0.2)
> ==4356== by 0x4447D2D: dolfin::SubSystemsManager::init_mpi(int, char**, int) (SubSystemsManager.cpp:105)
> ==4356== by 0x6A5290F6: ???
> ==4356==
> ==4356==
> ==4356== HEAP SUMMARY:
> ==4356== in use at exit: 216,904 bytes in 2,762 blocks
> ==4356== total heap usage: 15,363 allocs, 12,601 frees, 16,730,239 bytes allocated
> ==4356==
> ==4356== LEAK SUMMARY:
> ==4356== definitely lost: 3,571 bytes in 56 blocks
> ==4356== indirectly lost: 2,222 bytes in 32 blocks
> ==4356== possibly lost: 0 bytes in 0 blocks
> ==4356== still reachable: 211,111 bytes in 2,674 blocks
> ==4356== suppressed: 0 bytes in 0 blocks
> ==4356== Rerun with --leak-check=full to see details of leaked memory
> ==4356==
> ==4356== For counts of detected and suppressed errors, rerun with: -v
> ==4356== Use --track-origins=yes to see where uninitialised values come from
> ==4356== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
>
>

Revision history for this message
Miro (miroslav-kuchta) said :
#2

Thanks Johan Hake, that solved my question.