Are heap objects never moved by the garbage collector?

Simen Kjaeraas simen.kjaras at gmail.com
Fri May 31 10:08:14 PDT 2013


On 2013-05-31, 18:31, Carl Sturtivant wrote:

>
> "The D Programming Language" (TDPL) p.178 asserts the following.
>
> "The objects themselves stay put, that is their locations in memory  
> never change after creation."
>
> I take this to mean that the D garbage collector doesn't move live  
> objects and adjust all references to them the way that some garbage  
> collectors do. That is to say, the addresses of objects are not changed  
> by the garbage collector.
>
> Does D guarantee this?

The current D GC does guarantee this. Some future collectors might not,
but there will always be implementations that guarantee it.

-- 
Simen


More information about the Digitalmars-d-learn mailing list