[Issue 19322] A lot of memory is consumed and not freed to the system when Exception is formatted with stacktrace in debug

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 21 01:09:00 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19322

kinke at gmx.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kinke at gmx.net

--- Comment #1 from kinke at gmx.net ---
This is probably because at least for ELF, the .debug_line section data is
mmap()ped from the executable file and not unmapped after looking up file and
line infos for the frames in the backtrace.

The mmapped section data is owned by the ElfSection struct (via its its
MMapRegion member) created in the return statement in
Image.getDebugLineSectionData(). What's actually returned is the data array via
alias this, and the ElfSection struct (and its MMapRegion member) apparently
aren't destructed, which seems to be a bug in its own right.

I only know because I 'had' to replicate this leaking behavior in
https://github.com/dlang/druntime/pull/2330/files#diff-a10edf024597f176f219ea3c0cb2bdafR64,
otherwise the data array was invalid (unmapped) as soon as the data slice was
returned.

Possible fix: pass a delegate processing the section data (something like
`Image.processDebugLineSectionData(dg)`), so that the Image type can hold and
release the data itself.

--


More information about the Digitalmars-d-bugs mailing list