How Garbage Collector works?
BCS
none at anon.com
Thu Aug 12 07:08:30 PDT 2010
Hello Borneq,
> Użytkownik "Lars T. Kyllingstad" <public at kyllingen.NOSPAMnet> napisał
> w wiadomości news:i40dhi$55q$1 at digitalmars.com...
>
>> Since the GC keeps track of the length of the memory block, it can
>> also
>> tell whether the pointer is inside the memory block.
>> if (pointer >= startOfBlock && pointer < startOfBlock + blockLength)
>> doNotCollect();
> How compute startOfBlock ? GC keep startOfBlock for each pointer
> (pointer
> consits of actual pointer and pointer to startOfBlock)?
> or search for pointer such Block that pointer betwen
> startOfBlock..startOfBlock + blockLength ?
The GC keeps a some sort of table of what it has allocated. IT can then just
look up all the startOfBlock/blockLength values.
http://en.wikipedia.org/wiki/Garbage_collection_(computer_science)#Na.C3.AFve_mark-and-sweep
--
... <IXOYE><
More information about the Digitalmars-d
mailing list