Go: A new system programing language

Mike Hearn mike at plan99.net
Wed Nov 18 05:44:24 PST 2009


> Mixing D's gc world with manually managed memory isn't 
> hard, as long as  the following rules are followed:
> 
> 1. don't allocate in one language and expect to free in another
> 2. keep a 'root' to all gc allocated data in the D side of the fence 
> (otherwise it may get collected)

Yes it's the second that's the tough part. For instance consider the case of passing a callback (delegate) to the RPC system written in c++. How do you keep the associated data rooted without causing leaks? You'd need to remember to manually add it to the gc roots when the callback object is created and then unroot them when it's invoked. So this needs some kind of glue/binding system.

I'm not saying it's impossible or even hard. Just that I've seen such things done before and they were non-trivial.



More information about the Digitalmars-d mailing list