How does GC.addRange work?

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Sep 20 13:44:08 PDT 2014


On Sat, 20 Sep 2014 20:14:35 +0000
Gary Willoughby via Digitalmars-d-learn
<digitalmars-d-learn at puremagic.com> wrote:

> How does GC.addRange work? i.e. what is it doing? I'm assuming 
> reading the docs that it adds a range for the GC to scan but what 
> actually happens? Does the GC look into this range and check for 
> the existence of pointers it's currently managing?
yes. this adds GC "root". but normal GC root is just a single pointer,
and "range root" as a memory region that will be scanned for pointers
(i.e. something like "array of pointers").

note that scan is conservative, so if you happen to have some integer
value that can be interpreted as pointer to GC-managed memory, it will
be considered as pointer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20140920/8f08d58e/attachment.sig>


More information about the Digitalmars-d-learn mailing list