Hi, I have some code which is using libbfd (binutils 2.22) abundantly, and I couldn't help but notice memory usage grow to a couple GB after a while. I'm of course calling bfd_close() for every bfd opened, but some memory allocated from within libbfd.so is never freed.
I plugged my home-made memory debugger to investigate and found leaks such as this one : #0 objalloc_create() in libbfd-2.22.so, objalloc.c:100 (0x7f15ce489db7) #1 _bfd_new_bfd() in libbfd-2.22.so, opncls.c:75 (0x7f15ce3cf241) #2 bfd_fopen() in libbfd-2.22.so, opncls.c:215 (0x7f15ce3cf5ab) #3 bfd_openr() in libbfd-2.22.so, opncls.c:291 (0x7f15ce3cf755) #4 find_line() in libbfd-2.22.so, dwarf2.c:3208 (0x7f15ce3ea53a) #5 _bfd_dwarf2_find_nearest_line() in libbfd-2.22.so, dwarf2.c:3461 (0x7f15ce3ead1f) #6 _bfd_elf_find_nearest_line() in libbfd-2.22.so, elf.c:7479 (0x7f15ce40d8da) #7 _mmDebugBfdResolveSymbolSection() in mmdebug.so, mmdebugsymbol.c:134 (0x7f15d00e0fc3) #8 bfd_map_over_sections() in libbfd-2.22.so, section.c:1284 (0x7f15ce3d3371) Basically, within the call to bfd_find_nearest_line(), dwarf2.c's find_line() is opening a new debug_bfd and that bfd is never freed anywhere. The corresponding objalloc_free() is never called. I haven't dig enough to understand why the memory isn't freed. I can investigate further but I assumed others here would find the issue faster than I would. Thanks, let me know if I can help in any way. Alexis _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils