A question about the GC

Jarrod qwerty at ytre.wq
Sun Dec 23 19:26:05 PST 2007


Hey all,

I have a C library that takes the address to a class and stores it, 
associating the address of the class with a cluster of data. That way, if 
I try to create a second class tied to the same data, it merely passes 
back the address of the first class. Also, if the data is destroyed, it 
explicitly calls the class destructor for me.

This is all well and good, but my concern is that the garbage collector 
may reallocate my class if it is a 'copying' gc (I'm not really sure what 
it really is, I can't see it mentioned anywhere). If my class is moved, 
what happens to the pointers in my C code? Will they be updated too? I 
doubt it.
Is this a cause for concern or is D's GC of the non-moving variety? If it 
does indeed move I guess I'll have to override new/delete.

Thanks,


More information about the Digitalmars-d-learn mailing list