Hello (forgive my english) First: I’m sooner or later ending with a java.lang.OutOfMemoryError
I'm making an application to display boxes packed in a pallet/container. The scene I’m creating is like this: BG(1) | TG(2) / \ / \ (3)BG BG(4) / \ / \ (5)BG .. BG(6) 1.- Root BranchGroup. 2.- TransformGroup (to handle rotations). 3.- A BranchGroup containing all boxes. 4.- A BranchGroup containing the container shapes. 5 to 6.- Classes (instances) that extends from BranchGroup) that creates all the shapes of a box. >From 5 to 6 can be from 1 to 4000 nodes, where each node is a box created with 6 shapes 3d. The code is something like: public class VBox extends BranchGroup { // ... Not important private void createGeometry(Appearance appearance1) { // Create QUADS (Once for each face), The p3fArray and // the Point3f inside are statics And shared by all boxes p3fArray[0].set(xmin, ymin, zmax); p3fArray[1].set(xmin, ymax, zmax); p3fArray[2].set(xmin, ymax, zmin); p3fArray[3].set(xmin, ymin, zmin); addChild(createQuad(p3fArray, appearance1)); addChild(createQuad(p3fArray, appearance2)); // The code above is repeated once for each face of the box } private Shape3D createQuad(Point3f[] p3f, Appearance app) { QuadArray quadArray = new QuadArray(4, QuadArray.COORDINATES); quadArray.setCoordinates(0, p3f); Shape3D ret = new Shape3D(); ret.setAppearance(appearance); ret.setGeometry(quadArray); return ret; } } I’m sure that this object is being eventually garbage collected (I override finalize to find this out) and the QuadArray and Shape3D are being finalized too. Appareance, Color3f, etc, objects and all it’s attributes are static or shared, so the OutOfMemory does not comes from there. I’m sure that the non Java3D code is optimized and does not waste memory and it’s not the cause of the problem. I’m able to load and see some boxes distributions, but memory gets increased when I change the solution being displayed and sooner or later I get the OutOfMemory. Nodes 1 and 2 are always present. To change a “boxes distributions” I just detach nodes 3 and 4 (the old distribution) and attach the nodes right nodes for the “new current distribution”. I’m sure that there isn’t a reference to old nodes 3 and 4 after that (in fact my VBox objects gets finalized). I also added System.gc() calls in critical parts and the situation gets better but after browsing some distributions I still get the OutOfMemory (and the performance gets very bad) At the point before display a distribution the applications has 23MB of memory. After the first 5 distribution it has 65MB after 10/15 it has almost 97MB and from that point I can view some distributions but if I try to see a big one (1000 boxes or more) I get the OutOfMemory. I also tried with the JVM option –Xincgc and the situation gets controlled, but the performance is very bad. I heard about problems with the SimpleUniverse being created and destroyed and I tried both approaches: 1.- Keep a singleton, 2.-create and cleanup() the SimpleUniverse each time I change a distribution. With both I have the same problem. I really don’t know what else to do. If any body has a suggestion or If I’m doing something wrong I would appreciate the help. Thanks, Demián. =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".