A question about moving GC

Lars Ivar Igesund larsivar at igesund.net
Sat Jun 3 03:14:17 PDT 2006


Max Samuha wrote:

> How to ensure D code that interoperates with external libraries will
> work when a moving gc is eventually used with D? Will i need to add
> lots of pinning/unpinning code?
> 
> extern(C) external(Foo* foo);
> 
> struct Foo
> {
> }
> 
> class Bar
> {
> Foo foo;
> }
> 
> main()
> {
> Foo* foo = new Foo();
> 
> // Should foo be pinned before the call?
> external(foo);
> 
> Bar bar = new Bar();
> 
> // Should bar be pinned before the call?
> external(&bar.foo);
> }
> 
> 
> btw, ares seems to provides a moving gc and does have a gc.pin method.
> Should i consider looking closer at ares? Thanks

The GC in Ares is currently the same as the one in Phobos, but the interface
in Ares should make it possible to easier switch between other types of
GC's.

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource & #D: larsivi



More information about the Digitalmars-d-learn mailing list