memory leaks in numa_run_on_node
"Andrew J. Schorr" <[email protected]> Wed, 26 Jun 2013 20:05:12 -0400
| Newsgroups | org.kernel.vger.linux-numa |
|---|---|
| Message-ID | <[email protected]> |
Hi,
According to valgrind, this trivial program has a bunch of memory leaks:
bash$ cat numaleak.c
#include <numa.h>
int
main(int argc, char **argv)
{
numa_run_on_node(0);
return 0;
}
bash-4.2$ valgrind --leak-check=full --show-reachable=yes numaleak
==17943== Memcheck, a memory error detector
==17943== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==17943== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==17943== Command: numaleak
==17943==
==17943==
==17943== HEAP SUMMARY:
==17943== in use at exit: 4,144 bytes in 3 blocks
==17943== total heap usage: 35 allocs, 32 frees, 74,720 bytes allocated
==17943==
==17943== 16 bytes in 1 blocks are still reachable in loss record 1 of 3
==17943== at 0x4C2B78F: malloc (vg_replace_malloc.c:270)
==17943== by 0x4E36F55: numa_bitmask_alloc (in /usr/lib64/libnuma.so.1)
==17943== by 0x4E38B2E: numa_node_to_cpus (in /usr/lib64/libnuma.so.1)
==17943== by 0x4E39449: numa_run_on_node (in /usr/lib64/libnuma.so.1)
==17943== by 0x40055A: main (numaleak.c:6)
==17943==
==17943== 32 bytes in 1 blocks are still reachable in loss record 2 of 3
==17943== at 0x4C29A84: calloc (vg_replace_malloc.c:593)
==17943== by 0x4E36F72: numa_bitmask_alloc (in /usr/lib64/libnuma.so.1)
==17943== by 0x4E38B2E: numa_node_to_cpus (in /usr/lib64/libnuma.so.1)
==17943== by 0x4E39449: numa_run_on_node (in /usr/lib64/libnuma.so.1)
==17943== by 0x40055A: main (numaleak.c:6)
==17943==
==17943== 4,096 bytes in 1 blocks are still reachable in loss record 3 of 3
==17943== at 0x4C29A84: calloc (vg_replace_malloc.c:593)
==17943== by 0x4E38668: ??? (in /usr/lib64/libnuma.so.1)
==17943== by 0x4E38B18: numa_node_to_cpus (in /usr/lib64/libnuma.so.1)
==17943== by 0x4E39449: numa_run_on_node (in /usr/lib64/libnuma.so.1)
==17943== by 0x40055A: main (numaleak.c:6)
==17943==
==17943== LEAK SUMMARY:
==17943== definitely lost: 0 bytes in 0 blocks
==17943== indirectly lost: 0 bytes in 0 blocks
==17943== possibly lost: 0 bytes in 0 blocks
==17943== still reachable: 4,144 bytes in 3 blocks
==17943== suppressed: 0 bytes in 0 blocks
==17943==
==17943== For counts of detected and suppressed errors, rerun with: -v
==17943== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)
This is using version 2.0.8 of numactl on a Fedora 16 system.
There are similar memory leaks in numa_run_on_node_mask().
Regards,
Andy