As promised, here is a followup on the GC problems reported earlier in the week.
After examining the GC frequency when running the HelloUniverse example, I was
able to identify some memory leaks in Java3D which will be fixed in the next bug
fix release. There will probably always be some amount of leakage, but we will
continue to minimize it. Better garbage collectors, like the one in the Solaris
Production VM, will run less frequently and more quickly, but good memory
manangment will continue to be important in both J3D and application code.
Here are the details:
On my system (a Sun Ultra2 with 2 167Mhz processors and an Elite3D graphics
board), running HelloUniverse with the reference implementation of JDK 1.2 (the
"Classic VM"), I see:
Time between Leak Rates
GCs (sec) Objects/ KBytes/
second second
Before: 2.6 5000 240
After: 26 470 42
Each GC takes 40-50ms, the GC rate is measured after several GC's since the
initial rate is higher.
Using the Solaris production VM (the "Exact VM"), the results are similar:
Before: 8 sec between GCs,
After: 50 sec between GCs.
However, the GC takes <10ms on the Exact VM.
Notes:
-- The leaks I found were almost from using small temporary arrays once per
method call. Changing these to be class variables which are reused
eliminated the leaks at the expense of a small increase in the memory by the
objects.
-- There is still some leakage, but it is difficult to find *all* the leakage
cases. The best tools I could find were 1) to to look for changes to the
heap using -Xrunhprof to repeately dump the heap, and 2) to examine the code,
looking for new's, using -Xrunhprof:cpu=times to show the methods being
called frequently during the animiation. Hopefully better tools are coming.
-- There will be greater leakage rates for other funtionality. For example,
after these changes, TickTockCollision GC's every 12sec vs 26sec for
HelloUniverse.
-- It is difficult to make comparisions between platforms, since the GC rate is
dependent on the frame rate, which is very platform dependent (I get about 70
frames/sec on my box).
Hope this helps,
Doug Gehringer
Sun Microsystems
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/