GSoC 2016 - Precise GC
    thedeemon via Digitalmars-d-announce 
    digitalmars-d-announce at puremagic.com
       
    Sun May  8 21:08:08 PDT 2016
    
    
  
On Sunday, 8 May 2016 at 11:16:56 UTC, deadalnix wrote:
>> Ones that have only pointers are probably OK too. Though I'm 
>> not sure if a precise scanner takes into account the type of 
>> the pointer. I would expect it to use embedded typeinfo in 
>> target block.
>>
>> -Steve
>
> Because of void* and classes, the GC MUST be able to find out 
> what type was actually allocated, or at least its pointer 
> bitmask.
Yep, and it does that by looking at metadata of the pointed 
object itself, it doesn't care about the type of pointer to that 
object. I mean if we have object x of class X in heap and 
pointers "X p1", "void* p2" and "Y p3" all having same value &x 
(pointing to the same address) then GC will have no problem in 
scanning x as long as it can access x's type info knowing the 
address of x in heap. Which means all p1, p2 and p3 might easily 
be just at one position in a union and that would not be a 
problem.
    
    
More information about the Digitalmars-d-announce
mailing list