[Issue 5653] New: Allocating in a destructor called during a GC corrupts memory
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Feb 25 19:04:48 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5653
Summary: Allocating in a destructor called during a GC corrupts
memory
Product: D
Version: D1 & D2
Platform: All
OS/Version: All
Status: NEW
Keywords: patch
Severity: critical
Priority: P2
Component: druntime
AssignedTo: nobody at puremagic.com
ReportedBy: thecybershadow at gmail.com
--- Comment #0 from Vladimir <thecybershadow at gmail.com> 2011-02-25 19:02:00 PST ---
Created an attachment (id=922)
Very simple patch against D1's gcx.d which throws OutofMemory when allocating
during a GC run
D's current garbage collector is completely unprepared to handle an allocation
which is called by a finalizer. Such an allocation puts D's GC into an
inconsistent state, which ultimately leads to memory corruption.
The GC should either forbid allocating in destructors (by throwing an
exception), or properly support it (which may be non-trivial).
If the first solution is chosen, it should be noted that there are instances of
allocations in destructors in Phobos as well (such as std.zlib).
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list