setTransform -> out of memory (bug ?)

Hello!

We're using

Java 3D [dev] 1.5.0-build4-experimental 28 Jun 2006 09:30:26 PDT

We use this piece of code within a class extending TransforumGroup:

transform.setTranslation(new Vector3d(pos.x,pos.y,pos.z));

setTransform(transform);

We need to call this quite often, since it updates the Position of Objects on our Scene.

The garbage collector shows that the used memory is growing with each call ... until it is full:

[Full GC 13491K->12667K(21820K), 0.1180618 secs]

[Full GC 14001K->12952K(22844K), 0.1196116 secs]

[Full GC 14488K->13655K(23320K), 0.1211732 secs]

[Full GC 15094K->14266K(24552K), 0.1206172 secs]

[Full GC 15624K->14787K(25700K), 0.1229937 secs]

...

[Full GC 64952K->64952K(65088K), 0.2606679 secs]

Exception in thread"AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space

Exception in thread"J3D-GeometryStructureUpdateThread-1" java.lang.OutOfMemoryError: Java heap space

We just need to remove

setTransform(transform);

and this problem disappears.

We made a variety of tests and came to the estimation that setTransform() finally causes Java to run out of memory.

The very strange thing:

We've got another (similar) class extending TransformGroup, which also calls setTransform() after each frame, but does not cause the system to run out of memory !

The objects of the two different classes are each stored within a BranchGroup. So we got two BranchGroups - stored within another main TransformGroup, which is finally drawn.

Any hint ? :)

[1728 byte] By [IncrediblePhina] at [2007-10-3 0:30:50]
# 1

I'm not sure why that might be happening, but if you think it might have to do with the fact that the transform you are using is being generated by a vector, perhaps you could try generating it with a matrix instead.

Another thing I wonder about is exactly how big this vector is. I don't know how well java 3D handles very Large, sparse scene graphs. That could be one reason why you might get out of memory errors in some cases and not others.

- Adam

guitar_man_Fa at 2007-7-14 17:23:57 > top of Java-index,Security,Cryptography...
# 2

Hi,

I ran into the same problem and found a way to avoid it but it's a bit strange.

In fact rather than updating my transforms each time I needed it, I updated only 1 times in 100. It worked perfectly.

Seems like java3d doesn't like to be flooded with setTransform, or maybe there is a good moment to perform the setTransorm but I don't know how to know when this moment occurs.

Anyway it's my first day with Java3D so there is probably a more elegant way to do it.

Good luck.

phildera at 2007-7-14 17:23:58 > top of Java-index,Security,Cryptography...
# 3
I am getting the same out of memory error from many calls to setTransform. Has anyone found a solution to this problem?
sawonga at 2007-7-14 17:23:58 > top of Java-index,Security,Cryptography...