A question about moving GC

Stewart Gordon smjg_1998 at yahoo.com
Fri Jun 9 07:37:21 PDT 2006


Walter Bright wrote:
> Stewart Gordon wrote:
<snip>
>> But what if the foreign code needs to hold onto the pointer for longer 
>> than it can remain on the stack?
> 
> Have the D caller code keep a copy, or use addRoots

What is addRoot_s_?

> to tell the gc where the foreign code is holding it.

How will I know where the foreign code is holding the pointer?  Surely 
it makes more sense to add the pointer itself as a root.

Moreover, the pinning methods'll need to be documented.  So at the 
moment, I'm guessing that the following will implicitly pin a 
GC-allocated block:

- storing a pointer to it in a union
- having a pointer to it on the stack
- adding it as a root

Stewart.



More information about the Digitalmars-d-learn mailing list