pass a delegate to an API as a context pointer?
teo
teo.ubuntu at yahoo.com
Tue Jul 3 00:26:32 PDT 2007
Kirk McDonald Wrote:
> There is a serious problem with this. The garbage collector will not
> scan the C library for references. As far as it is concerned, that
> struct on the heap will have no references to it (assuming your program
> is more interesting than a single main() function, and this callback is
> being assigned in some function that returns), and it might be
> collected. Furthermore, if that delegate holds the only reference to
> that 'A' instance, it might be collected, too.
>
> You'll need to somehow keep a reference to that struct locally (that is,
> within your D code).
Is there any way to force the garbage collector to "cleanup", so I can experiment with it and see where my software breaks? Perhaps I do have some weak references.
More information about the Digitalmars-d
mailing list