|
From: Arne B. <abr...@xy...> - 2005-05-07 15:37:00
|
Hi all,
hope you guys can help me: I'm using a dynamic loaded module as part
of the net-snmp daemon. This module writes data into an xmlfile using
libxml2. When I run snmpd under valgrind, it displays three
memoryleaks after stopping the daemon.
I can't really see which are the memoryleaks exactly, because there
are (partly) no filenames/linenumbers given, I think this is because
of the callbacks.
The thing is, writing exactly the same data from an independent tool
using the same writing function does not yield any memory leaks.
Through commenting out parts of my module, I tracked the leaks down
into the xmlfile writing function, which makes use of a couple of
libxml2 functions.
Any ideas?
Arne
Here's my system setup:
Redhat 9.0 with newest updates
- couple of packages upgraded independently:
beecrypt-3.1.0-3
popt-1.9.1-0.3
db4-4.1.25-14
python-2.2.3-7
elfutils-0.95-2
elfutils-libelf-0.76-3
rpm-4.3.1-0.3
libpcap-0.8.3-3
libselinux-1.11.4-1
libxml2-2.6.19-1
lm_sensors-2.6.5-5
yum-2.2.0-1
Kernel 2.4.20-8 SMP
Processors Intel Xeon CPU 2.40GHz, Hyperthreading
Involved software versions:
valgrind-2.4.0
libxml2-2.6.19-1
net-snmp-5.2.1
Libc (rpm -qa | grep libc):
glibc-kernheaders-2.4-8.10
glibc-devel-2.3.2-27.9.7
glibc-common-2.3.2-27.9.7
glibc-2.3.2-27.9.7
Here's valgrinds output:
-----8<-----
ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 346 from 16)
malloc/free: in use at exit: 453983 bytes in 16227 blocks.
malloc/free: 36957 allocs, 20730 frees, 2090457 bytes allocated.
For counts of detected errors, rerun with: -v
searching for pointers to 16227 not-freed blocks.
checked 2243900 bytes.
84 bytes in 1 blocks are definitely lost in loss record 66 of 129
at 0x1B903534: malloc (vg_replace_malloc.c:130)
by 0x1C6CC96E: ???
by 0x1C70EF3B: ???
by 0x1C70F112: ???
by 0x1C66BF97: ???
by 0x1C66C356: ???
by 0x1C67B163: ???
by 0x1C713C6F: ???
by 0x1C61862B: ???
by 0x1C615083: ???
by 0x1C6151F7: ???
by 0x1BA54CEC: process_set_group (table_array.c:654)
19664 (40 direct, 19624 indirect) bytes in 1 blocks are definitely lost in loss record 92 of 129
at 0x1B903534: malloc (vg_replace_malloc.c:130)
by 0x1C713922: ???
by 0x1C713BA0: ???
by 0x1C713CA7: ???
by 0x1C61862B: ???
by 0x1C615083: ???
by 0x1C6151F7: ???
by 0x1BA54CEC: process_set_group (table_array.c:654)
by 0x1BADF775: _ba_for_each (container_binary_array.c:312)
by 0x1BA55018: process_set_requests (table_array.c:806)
by 0x1BA55377: netsnmp_table_array_helper_handler (table_array.c:849)
by 0x1BA25037: netsnmp_call_handler (agent_handler.c:423)
396 (200 direct, 196 indirect) bytes in 1 blocks are definitely lost in loss record 95 of 129
at 0x1B903534: malloc (vg_replace_malloc.c:130)
by 0x1C66778A: ???
by 0x1C667DA0: ???
by 0x1C68D00E: ???
by 0x1C67B152: ???
by 0x1C713C6F: ???
by 0x1C61862B: ???
by 0x1C615083: ???
by 0x1C6151F7: ???
by 0x1BA54CEC: process_set_group (table_array.c:654)
by 0x1BADF775: _ba_for_each (container_binary_array.c:312)
by 0x1BA55018: process_set_requests (table_array.c:806)
LEAK SUMMARY:
definitely lost: 324 bytes in 3 blocks.
indirectly lost: 19820 bytes in 42 blocks.
possibly lost: 0 bytes in 0 blocks.
still reachable: 424495 bytes in 15246 blocks.
suppressed: 9344 bytes in 936 blocks.
Reachable blocks (those to which a pointer was found) are not shown.
To see them, rerun with: --show-reachable=yes
-----8<-----
Explanation:
process_set_group is part of the netsnmplibs and calls a function from
my dynamic module by issuing a
context->tad->cb->set_action(ag);
(line 654 in table_array.c). My funtion does some stuff and finally
writes the xmlfile.
Suppressions enabled:
Bugs in libpthread, librpm and thousands of
uninitialized jumps in libsnmp and snmpd
|