A question about moving GC

Walter Bright newshound at digitalmars.com
Fri Jun 9 09:48:57 PDT 2006


Stewart Gordon wrote:
> 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_?

http://www.digitalmars.com/d/phobos/std_gc.html


>> to tell the gc where the foreign code is holding it.
> How will I know where the foreign code is holding the pointer?

First of all, the foreign code documentation ought to make some mention 
of what it does with the pointer - after all, it must even if you 
malloc'd it so you know when and if you can ever free it. Have the D 
code caller call addRoot.



More information about the Digitalmars-d-learn mailing list