[Issue 13038] Calling to!String in the destructor

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jul 3 21:52:46 PDT 2014


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

Jonathan M Davis <jmdavisProg at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jmdavisProg at gmx.com
         Resolution|---                         |INVALID

--- Comment #1 from Jonathan M Davis <jmdavisProg at gmx.com> ---
It is invalid to allocate memory in a class destructor, which to!string is
going to do unless it's passed a string. It's probably working when you call
destroy, because then the destructor is not being called by the GC, but the GC
does not allow you to do anything with it when it's running a collection -
which means that class destructors cannot manipulate the GC heap. It might be
annoying at times, but it's a limitation that we have to live with.

--


More information about the Digitalmars-d-bugs mailing list