Less known std.gc

Lutger lutger.blijdestijn at gmail.com
Mon Nov 19 05:03:50 PST 2007


bearophile wrote:
> The std.gc module of Phobos contains various things that I don't undertand:
> 
> void addRoot(void* p);
> void removeRoot(void* p);
> void addRange(void* pbot, void* ptop);
> void removeRange(void* pbot);
> void setTypeInfo(TypeInfo ti, void* p);
> void* getGCHandle();
> void setGCHandle(void* p);
> 
> Maybe you can point me to some more info about their usage and usefulness, or some code that uses them. (I think the docs of Phobos can gain some usage examples of those functions).
> 
> Bye and thank you,
> bearophile

Hi, some of these functions are documented in Tango's GC, which are 
probably identical:

http://www.dsource.org/projects/tango/docs/current/tango.core.Memory.html

There is also an example of overriding new for classes that contain some 
of these functions:

http://www.digitalmars.com/d/memory.html#newdelete


These links are about the first four functions only. These are useful to 
let the GC know whether some parts of memory should be scanned or not. I 
don't know about the other functions.


More information about the Digitalmars-d-learn mailing list