Java3D & garbage collection

Hello!
I’m developing an Italian Poker game in Java3D.
I’m new in Java2 and Java3D programming and I’m experiencing problems with memory.

In the game I build a SimpleUniverse with several BranchGroups which can be detached at runtime, each containing a lot of TransformGroups.
There’s also a dedicated BranchGroup for Behaviors.
Each detached Branchgroup is eliminated immediately, calling the gc.

myDetachedBG = null;
System.runFinalization();
System.gc();

At the end of the game, I call

mySimpleUniverse.removeAllLocales();
System.runFinalization();
System.gc();

to free memory and start a new game.
Unfortunately only a small amount of memory is collected, and when I start the game again it begins to grow.
I don’t think it’s a problem of circular reference.

Can you help me?
Thanx and excuse me if my English is not so good.
Giuseppe

You are not alone.

AFAIK there are known memory leaks and probably unknown ones. We experience the same where the leaks seems to be somewhere around TriangleStripArray. Unfortunately, this is for our terrain so the leak is really big (~10MB). But I’ve not been able to isolate it. Maybe you can?

Currently there’s a Java3D beta on the way, so it would be cool if such leaks could be eliminated before RC.

Unfortunately I wasn’t able to isolate the leak. I’m wondering if the problem is about BranchGroup detaching.
In fact I used to remove some animations by detaching their parent bg, and then I used to null-sign them to make them eligible for gc.
Maybe Java GC can’t handle detached complex SceneGraphs?
As I told you I’m new in Java programming, and probably I’m wrong.
But I don’t think Sun’s Vanilla GC is as smart as they say!

tryed with :
-Xincgc enable incremental garbage collection
???

I executed my program with the incremental GC on, but I got only little benefits.
I tried also to execute with “java verbose:gc …” on and noticed leaks of 10-15 mb every time I rebuild my SceneGraph. Memory usage grows until java.lang.OutOfMemory!!!
Yesterday I searched a lot and I found some evidence about leaks in :

javax.media.j3d.Transform3D.(Transform3D.java:87)

javax.media.j3d.SceneGraphPath.(SceneGraphPath.java:61)

javax.media.j3d.Picking.getSceneGraphPath(Picking.java:362)

javax.media.j3d.Picking.pickAllSorted(Picking.java:88)

javax.media.j3d.Locale.pickAllSorted(Locale.java:599)

rob.kit.KitUtilities.pick(KitUtilities.java:64)

What do you think about these?
Oh…by the way. I use jdk1.4.1 and java3D1.3.1OGL

There is a current discussion on memory leaks in the context of picking on the Java3D mailing list.
I didn’t follow the discussion so I don’t know any details.