Go: A new system programing language

Sean Kelly sean at invisibleduck.org
Wed Nov 18 07:17:38 PST 2009


Walter Bright Wrote:

> Sean Kelly wrote:
> > Walter Bright Wrote:
> >> 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)
> > 
> > This may actually work in D 2.0.  core.thread has thread_attachThis()
> > to make the D GC aware of an external thread, and gc_malloc() is an
> > extern (C) function.  I haven't tested this extensively however, so
> > if you're keen to try it, please let me know if there are any
> > problems.
> 
> There's a more fundamental problem. There is simply no reliable way to 
> find all the static data segments in a program. I talked with Hans Boehm 
> about this, he uses some horrific kludges to try and do it in the Boehm 
> gc. This problem is on every OS I've checked.

Yeah, that's a problem.  I've looked at this part of the Boehm collector too and it's absolutely horrifying.  You'd think with the popularity (and history) of GC that there would be some API-level way to do this.



More information about the Digitalmars-d mailing list