Re: [Java-gnome-developer] Use of destroy()
Brought to you by:
afcowie
From: Jerry H. <wa...@la...> - 2004-10-30 15:01:43
|
You're right. What I meant was that we have NO way to manage memory in Java. It happens behind the scenes, on a GC process. So, we need to either tie into this process, which I don't think we can, or have our own "cleanup" process to delete C instances when the Java instance dies. This is the ref count idea. We scan our map, find items with a dead Java instance, and unref them, and remove them from the map. We are no longer using them. Our Java wrapper instances will stay alive as long as there is a reference to them. After they loose all references, they will die at some undetermined time in the future. If the object is being used in a signal handler, it will not be GC'd. You're C++ way of storing it in the data of the GObject is good... however, we need a way to map Java->Object to GObject as well. Java also conveniently lacks an efficient way to do this. |