[Dlang-internal] Using phobos in conjunction with the compiler code

Mathias Lang via Dlang-internal dlang-internal at puremagic.com
Fri May 26 06:57:39 PDT 2017


On Thursday, 25 May 2017 at 16:48:00 UTC, RazvanN wrote:
> On Wednesday, 24 May 2017 at 10:57:40 UTC, Mathias Lang wrote:
>> On Wednesday, 24 May 2017 at 10:40:42 UTC, RazvanN wrote:
>>> Does anyone have any idea what the problem might be?
>>>
>>> Thank you,
>>> RazvanN
>>
>> Since my emails don't seem to go through in a timely fashion:
>>> You should also disable the GC.
>
> Thank you. It does, indeed, solve the problem. But I am 
> curious, why was it segfaulting?

DMD uses a mix of allocations strategy.

My guess is that some references to GC-allocated memory are 
stored into non GC-allocated memory, and those chunks of memory 
are not added as GC roots. So when the GC decides to collect 
memory, it thinks those objects are dead and recycle them. From 
there, you end up with a dangling pointer.


More information about the Dlang-internal mailing list