Garbage Collection, Untraceable Errors...

Vladimir Panteleev via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 13 12:06:13 PDT 2016


On Monday, 13 June 2016 at 16:43:57 UTC, cy wrote:
> On Monday, 13 June 2016 at 08:58:40 UTC, Vladimir Panteleev 
> wrote:
>>
>> FWIW: http://wiki.dlang.org/InvalidMemoryOperationError
>
> Yeah... I did forget that the GC was not re-entrant. But the 
> "stop collecting inside the destructor, moron" error is exactly 
> the same as "something allocated in the destructor... moron" 
> error.

"The GC is not re-entrant" applies to all of its parts, not only 
the actual part doing the GC and reclaiming memory - i.e. calling 
any GC function (allocation or an explicit free) while a GC 
function is running is not supported. In practice, this only 
applies to allocation/free from a destructor invoked by a GC 
sweep though.

> I'd think we could just allocate space for a potential stack 
> trace before starting garbage collection, but I guess not?

The problem is certainly solvable, but, well, a GC cycle is 
initiated precisely when the runtime runs out of memory.



More information about the Digitalmars-d mailing list