Re: [Java-gnome-developer] OptionMenu events etc..
Brought to you by:
afcowie
From: Mark H. <mh...@ca...> - 2003-10-08 09:02:08
|
On Wed, Oct 08, 2003 at 12:43:34AM +0300, Jonas Berlin wrote: > I do. =) And some test code also.. I put a textview test already there, > looks like a tricky one (unless my test is faulty somehow).. But I can > make the java process grow just as well by "just" creating 100000 (or some > insane number) labels and then letting the garbage collector pick them > up.. Even if I call Widget.destroy() on them, the native code seems to > keep memory references somewhere.. I haven't tested any other components > yet, or even looked at how the objects are handled in the native code part > of java-gnome.. I haven't looked in detail, but I think the problems are most likely caused by us not clearing up strings after passing them to gtk, rather than not destroying the widgets. Gtk/Glib should destroy them when they are no longer used (unless there has been a g_object_ref call). There is still probably work to do in this area. My main focus so far has been to get things working, then work on improving them. Performance and memory usage haven't been an issue in the large apps I've written so far, so I was hoping there weren't any major problems. > Generally I don't know how to handle data allocated by native code when > the object gets garbage collected.. is the only way to implement a native > void finalize() method that is then called when the object is garbage > collected, or is there a better way? I have heard implementing finalize() > methods in classes slows down execution, so hopefully there's some other > way to do it without the performance degradation.. We don't want to destroy native objects when java objects get GCd. Glib will sort these out at the right time. It is common to create an object, add it to a form and then remove all java references to it - the native widget must still exist. > Do you in general have plans to write some unit testing or similar on the > components? JUnit could be one way, but with java-gnome, it's quite easy > to pull together even the simplest test application, in fact so easy that > i find myself rather writing a gui for it than some text output =) See the tests directory in cvs. I think Jeff started work on it. Again, priorities have been to work on implementing features and fixing visible bugs rather than work on this, although I agree it is important. > Nice nice.. Your comment regarding putting an comment there (and maybe a > commented out method body for easier grepping).. I agree, that would have > been better. I think one of the items in Effective Java (a useful book) is about this. -- .''`. Mark Howard : :' : `. `' http://www.tildemh.com `- mh...@de... | mh...@ti... | mh...@ca... |