Shared keyword and the GC?

thedeemon dlang at thedeemon.com
Tue Oct 23 14:39:28 PDT 2012


On Monday, 22 October 2012 at 21:19:53 UTC, deadalnix wrote:

>>> Funny thing, immutable was supposed to make it easier to do 
>>> concurrency programming.
>>
>> But not garbage collection.
>>
>
> OCmal's GC is one of the fastest GC ever made. And it is the 
> case because it uses immutability to great benefice.

OCaml, I suppose. It is single threaded (there is no thread-level 
parallelism in OCaml) and there is nothing in its GC that uses 
immutability really. It's so fast because of the memory model: to 
tell if a word is a pointer one just needs to look at its least 
significant bit, if it's 0 it's a pointer, if it's 1 it's not. 
That's why native ints are 31-bit in OCaml. With this scheme they 
don't need to store type layout info and pointer bitmaps. And it 
is generational (2 gens), which also adds much speed.

A GC which really relies on immutability you can find in Erlang.


More information about the Digitalmars-d mailing list