Threading and the Garbage handler mess.

Alan Knowles alan at akbkhome.com
Tue Sep 9 21:12:13 PDT 2008


downs wrote:
> There's three trivial steps to solve ALL of this:
> 
> a) don't manually delete things, at all
unless they absolutely do not get used anywhere else..
> 
> b) store pointers that have been passed to C functions where the GC can see them. 
(eg. use  addRoot()/removeRoot()
> 
> c) For memory that's explicitly supposed to _belong_ to the C functions, use cstdlib malloc.

d) avoid using ~this() as it's called from the gc, and you can not 
guarantee the state of memory of the object..

> If you keep to these three points, things become very simple.

Yes, very good advice.

Regards
Alan




More information about the Digitalmars-d mailing list