This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/12509] New: dlopen(path_to_lib, RTLD_LOCAL|RTLD_NOLOAD) leaks memory
- From: "finkandreas at web dot de" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Wed, 23 Feb 2011 14:05:16 +0000
- Subject: [Bug libc/12509] New: dlopen(path_to_lib, RTLD_LOCAL|RTLD_NOLOAD) leaks memory
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=12509
Summary: dlopen(path_to_lib, RTLD_LOCAL|RTLD_NOLOAD) leaks
memory
Product: glibc
Version: 2.13
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper.fsp@gmail.com
ReportedBy: finkandreas@web.de
Created attachment 5254
--> http://sourceware.org/bugzilla/attachment.cgi?id=5254
Unittest (needs path to a library as argument)
calling dlopen(path_to_lib, RTLD_LOCAL|RTLD_NOLOAD) leaks memory. It's not
much, but it contains at least the whole path to the lib (i.e. the longer the
path, the more memory is leaked).
The library must be existent on harddisk, but not loaded yet!
Attached is a unittest, which calls dlopen 100 times, to show, that the leak
accumulates (i.e. with every call more memory is leaked). The attached program
needs one commandline argument, the path to the library.
This is the output of valgrind after running the program:
==32730== Memcheck, a memory error detector
==32730== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==32730== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
==32730== Command: ./test_memleak
/home/andreas/ITWM/alg/build/tools/ValueSmart/libvaluesmart.so
==32730==
==32730==
==32730== HEAP SUMMARY:
==32730== in use at exit: 6,300 bytes in 100 blocks
==32730== total heap usage: 100 allocs, 0 frees, 6,300 bytes allocated
==32730==
==32730== 6,300 bytes in 100 blocks are definitely lost in loss record 1 of 1
==32730== at 0x4C277CE: malloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==32730== by 0x4004E71: local_strdup (dl-load.c:162)
==32730== by 0x400762F: _dl_map_object (dl-load.c:2178)
==32730== by 0x4011EE8: dl_open_worker (dl-open.c:226)
==32730== by 0x400D8A5: _dl_catch_error (dl-error.c:178)
==32730== by 0x4011929: _dl_open (dl-open.c:555)
==32730== by 0x4E2EF75: dlopen_doit (dlopen.c:67)
==32730== by 0x400D8A5: _dl_catch_error (dl-error.c:178)
==32730== by 0x4E2F2FB: _dlerror_run (dlerror.c:164)
==32730== by 0x4E2EEF0: dlopen@@GLIBC_2.2.5 (dlopen.c:88)
==32730== by 0x400681: main (in /home/andreas/test_memleak)
==32730==
==32730== LEAK SUMMARY:
==32730== definitely lost: 6,300 bytes in 100 blocks
==32730== indirectly lost: 0 bytes in 0 blocks
==32730== possibly lost: 0 bytes in 0 blocks
==32730== still reachable: 0 bytes in 0 blocks
==32730== suppressed: 0 bytes in 0 blocks
==32730==
==32730== For counts of detected and suppressed errors, rerun with: -v
==32730== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 6 from 6)
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.