Is there some better way to force the Garbage Collector to Collect than using GCCollect()? Or indeed a better way to use GCCollect()?
I ask because my TrueVision3D module has to clean up after objects in delete methods. There is no user friendly alternative to this, sadly. If I don't do this, I'll have to completely ditch automatic garbage collection and force everyone to explicitly destroy everything. Which - even if I fancied it - goes a bit against the grain in a language which is supposedly superior because it has a GC.
So with my reasons justified, here's what I'm doing now. When I shut down the engine, the user may still have some TV objects floating around which haven't been disposed of, right? So I don't want those being called now, do I? Because the engine isn't there, so it will crash. So it seems like the best solution is to call GCCollect immediately before you shut down the engine, right? Then everything goes through, nothing is left behind, right? Doesn't work. Believe me, I wish it worked, but it doesn't. I can call GCCollect() as many times as I like but it won't flush some of these objects.
Hopefully not too many people are experiencing this, but if I am, they will soon enough. What else is there for me to do apart from call GCCollect()? ( and tell them to do the same, obviously. )
And no, I don't have any loose references flying around. The GC just seems to reach a point where it doesn't want to flush anything for a while, then a little time later, it will explode on a GCCollect trying to tell TV to free something that doesn't exist.
I ask because my TrueVision3D module has to clean up after objects in delete methods. There is no user friendly alternative to this, sadly. If I don't do this, I'll have to completely ditch automatic garbage collection and force everyone to explicitly destroy everything. Which - even if I fancied it - goes a bit against the grain in a language which is supposedly superior because it has a GC.
So with my reasons justified, here's what I'm doing now. When I shut down the engine, the user may still have some TV objects floating around which haven't been disposed of, right? So I don't want those being called now, do I? Because the engine isn't there, so it will crash. So it seems like the best solution is to call GCCollect immediately before you shut down the engine, right? Then everything goes through, nothing is left behind, right? Doesn't work. Believe me, I wish it worked, but it doesn't. I can call GCCollect() as many times as I like but it won't flush some of these objects.
Hopefully not too many people are experiencing this, but if I am, they will soon enough. What else is there for me to do apart from call GCCollect()? ( and tell them to do the same, obviously. )
And no, I don't have any loose references flying around. The GC just seems to reach a point where it doesn't want to flush anything for a while, then a little time later, it will explode on a GCCollect trying to tell TV to free something that doesn't exist.