A thought about garbage collection

deadalnix deadalnix at gmail.com
Wed Dec 19 18:06:27 PST 2012


On Thursday, 20 December 2012 at 01:54:42 UTC, Jonathan M Davis 
wrote:
> On Thursday, December 20, 2012 02:37:16 deadalnix wrote:
>> D's GC should really be aware of TL and immutability of what it
>> does allocate.
>
> The problem is casting. It's not uncommon to create something 
> as mutable and
> then cast it to immutable when done. It's stuff like that 
> screws with being
> able to per-thread GCs. Which thread owns what isn't always 
> clear.
>

This is where the concept of island make sense, but this is 
unreasonable to introduce that in D in any short term.

However, this kind of cast is explicitly specified as unsafe, and 
can have unexpected consequences, even in today's code. Obviously 
if the GC start to play with that, consequences will never be the 
same !!! (and by that I mean the consequences of a misuse can be 
way more dramatic)


More information about the Digitalmars-d mailing list