You are not logged in.
Pages: 1
openssl was configed by -DPURIFY . valgrind stil report below
==300== HEAP SUMMARY:
==300== in use at exit: 1,044 bytes in 13 blocks
==300== total heap usage: 24,386 allocs, 24,373 frees, 42,513,173 bytes allocated
==300==
==300== 17 bytes in 1 blocks are still reachable in loss record 1 of 6
==300== at 0x40264F2: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==300== by 0x40089F6: _dl_map_object (in /lib/ld-2.11.2.so)
==300== by 0x40136C1: dl_open_worker (in /lib/ld-2.11.2.so)
==300== by 0x400F3C6: _dl_catch_error (in /lib/ld-2.11.2.so)
==300== by 0x4013F77: _dl_open (in /lib/ld-2.11.2.so)
==300== by 0x4323B7B: dlopen_doit (in /lib/libdl-2.11.2.so)
==300== by 0x400F3C6: _dl_catch_error (in /lib/ld-2.11.2.so)
==300== by 0x432430C: _dlerror_run (in /lib/libdl-2.11.2.so)
==300== by 0x4323C31: [email protected]@GLIBC_2.1 (in /lib/libdl-2.11.2.so)
==300== by 0x42692D9: dlfcn_load (in /usr/lib/libcrypto.so.0.9.8)
==300==
==300== 17 bytes in 1 blocks are still reachable in loss record 2 of 6
==300== at 0x40264F2: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==300== by 0x400B4DF: _dl_new_object (in /lib/ld-2.11.2.so)
==300== by 0x4006907: _dl_map_object_from_fd (in /lib/ld-2.11.2.so)
==300== by 0x400877F: _dl_map_object (in /lib/ld-2.11.2.so)
==300== by 0x40136C1: dl_open_worker (in /lib/ld-2.11.2.so)
==300== by 0x400F3C6: _dl_catch_error (in /lib/ld-2.11.2.so)
==300== by 0x4013F77: _dl_open (in /lib/ld-2.11.2.so)
==300== by 0x4323B7B: dlopen_doit (in /lib/libdl-2.11.2.so)
==300== by 0x400F3C6: _dl_catch_error (in /lib/ld-2.11.2.so)
==300== by 0x432430C: _dlerror_run (in /lib/libdl-2.11.2.so)
==300== by 0x4323C31: [email protected]@GLIBC_2.1 (in /lib/libdl-2.11.2.so)
==300== by 0x42692D9: dlfcn_load (in /usr/lib/libcrypto.so.0.9.8)
==300==
==300== 28 bytes in 1 blocks are still reachable in loss record 3 of 6
==300== at 0x40264F2: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==300== by 0x400DD7C: _dl_map_object_deps (in /lib/ld-2.11.2.so)
==300== by 0x401371C: dl_open_worker (in /lib/ld-2.11.2.so)
==300== by 0x400F3C6: _dl_catch_error (in /lib/ld-2.11.2.so)
==300== by 0x4013F77: _dl_open (in /lib/ld-2.11.2.so)
==300== by 0x4323B7B: dlopen_doit (in /lib/libdl-2.11.2.so)
==300== by 0x400F3C6: _dl_catch_error (in /lib/ld-2.11.2.so)
==300== by 0x432430C: _dlerror_run (in /lib/libdl-2.11.2.so)
==300== by 0x4323C31: [email protected]@GLIBC_2.1 (in /lib/libdl-2.11.2.so)
==300== by 0x42692D9: dlfcn_load (in /usr/lib/libcrypto.so.0.9.8)
==300==
==300== 134 bytes in 8 blocks are still reachable in loss record 4 of 6
==300== at 0x40264F2: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==300== by 0x421070B: default_malloc_ex (in /usr/lib/libcrypto.so.0.9.8)
==300==
==300== 224 bytes in 1 blocks are still reachable in loss record 5 of 6
==300== at 0x4024FA3: calloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==300== by 0x4010BA8: _dl_check_map_versions (in /lib/ld-2.11.2.so)
==300== by 0x4013990: dl_open_worker (in /lib/ld-2.11.2.so)
==300== by 0x400F3C6: _dl_catch_error (in /lib/ld-2.11.2.so)
==300== by 0x4013F77: _dl_open (in /lib/ld-2.11.2.so)
==300== by 0x4323B7B: dlopen_doit (in /lib/libdl-2.11.2.so)
==300== by 0x400F3C6: _dl_catch_error (in /lib/ld-2.11.2.so)
==300== by 0x432430C: _dlerror_run (in /lib/libdl-2.11.2.so)
==300== by 0x4323C31: [email protected]@GLIBC_2.1 (in /lib/libdl-2.11.2.so)
==300== by 0x42692D9: dlfcn_load (in /usr/lib/libcrypto.so.0.9.8)
==300==
==300== 624 bytes in 1 blocks are still reachable in loss record 6 of 6
==300== at 0x4024FA3: calloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==300== by 0x400B231: _dl_new_object (in /lib/ld-2.11.2.so)
==300== by 0x4006907: _dl_map_object_from_fd (in /lib/ld-2.11.2.so)
==300== by 0x400877F: _dl_map_object (in /lib/ld-2.11.2.so)
==300== by 0x40136C1: dl_open_worker (in /lib/ld-2.11.2.so)
==300== by 0x400F3C6: _dl_catch_error (in /lib/ld-2.11.2.so)
==300== by 0x4013F77: _dl_open (in /lib/ld-2.11.2.so)
==300== by 0x4323B7B: dlopen_doit (in /lib/libdl-2.11.2.so)
==300== by 0x400F3C6: _dl_catch_error (in /lib/ld-2.11.2.so)
==300== by 0x432430C: _dlerror_run (in /lib/libdl-2.11.2.so)
==300== by 0x4323C31: [email protected]@GLIBC_2.1 (in /lib/libdl-2.11.2.so)
==300== by 0x42692D9: dlfcn_load (in /usr/lib/libcrypto.so.0.9.8)
==300==
==300== LEAK SUMMARY:
==300== definitely lost: 0 bytes in 0 blocks
==300== indirectly lost: 0 bytes in 0 blocks
==300== possibly lost: 0 bytes in 0 blocks
==300== still reachable: 1,044 bytes in 13 blocks
==300== suppressed: 0 bytes in 0 blocks
==300==
==300== For counts of detected and suppressed errors, rerun with: -v
==300== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 24 from 11)
Offline
Yeah, about the only thing you should really care about in valgrind's leak stats is
the "definitely lost" section... Those generally indicate real leaks that you should
probably find and fix... The rest are usually nothing wrong at all, and simply indicate
memory that wasn't explicitly freed at exit time... And, really, what's the point of
explicitly freeing all your memory at exit time? It's not required at all... Any OS worth
a damn will take care of that for you at exit time...
Offline
Well, it looks like dlopen() allocates memory which is never or partially freed.
dclose() probably frees up almost all of it, but I can imagine that dlopen()
constructs some data structure with loaded library information which is kept
around even if all loaded libs are closed. Think
...
if (!libs)
libs = malloc(sizeof(struct libs));
...
Your example allocated 45 megabtes of memory, and just kept 1 kilobyte around.
I bet that number doesn't increase much, if any, if your program allocated more
memory during its lifetime. It's not a memory leak, it's not a bug, it's only bugging
you because Valgrind shows you that info.
My advise is to ignore all Valgrind output not related to your own code.
If you want to "fix" this then read glibc's source code, write a patch, and send
it to their mailinglist or something. But you would have wasted your time on
"fixing" something that's not a real bug.
Offline
Pages: 1