Hi All! I have some difficulty understanding the behavior of a Link/SharedGroup construct in the scenegraph. I need to deploy lots of identical objects to a scene (e.g. tanks, soldiers) and thought that placing the object into a SharedGroup and using it with combinations of TransformGroup and Link nodes. This should save a lot of memory. Now, trying it, memory consumption EXPLODED!!!
So I did some HelloUniverse tests and found VERY strange results. I also used -Xrunhprof and found that, when huge amounts of memory are used, this is due to large numbers of javax.media.j3d.BranchGroupRetained objects. The results depend on the subgraph I wanted to reference. The numbers below have been gathered with a textured Fokker DR1 triplane loaded with StarfireExt.jar. This Fokker has been added 30 times to a Group, each with another TransformGroup ahead. 30 is not very much, but enough to waste 120MB! I tried different constructs starting without any Link at all using cloneTree() for each instance needed. I recorded the memory footprint from XPs TaskManager and the number of instances of javax.media.j3d.BranchGroupRetained from java.hprof.txt. Funny enough, the un-Linked graph with all the clones used the least memory at all. (why??) It turns out that the most simple construction uses the most memory and produces nearly 1.000.000 BranchGroupRetained! I want to understand what Link/SharedGroup actually does and - the primary goal - find a way to deploy a real lot of identical objects to a scene!! Not just 30. OTOH, using a much simpler subgraph (a ColorCube and 2 Text2D) showed the desired behavior and I could easily Link 10000 of these. Cloning here did not allow that much instances, but therefor the performance of cloned subgraphs shows up to be much better than of Linked. The Fokker in my application framework is constructed as in case (2) but blows memory there. S = SharedGroup (a certain instance, always the same) T = TransformGroup L = Link B = BranchGroup g = non-trivial subgraph (a certain instance, always the same) 1--------------------------------------------------------------------------- -- Not using Link/SharedGroup at all, just cloning the subgraph 30 times. T-B-T-g.cloneTree() Footprint: ~40MB javax.media.j3d.BranchGroupRetained: 670 2--------------------------------------------------------------------------- -- T-B-T-L-S-g Footprint: ~45MB javax.media.j3d.BranchGroupRetained: 100.000 3--------------------------------------------------------------------------- -- T-L-S-g Footprint: ~120MB javax.media.j3d.BranchGroupRetained: 825.000! 4--------------------------------------------------------------------------- -- As above, just modifying g to contain another Link/SharedGroup pair. T-L-S-B-T-L-S'-g Footprint: ~45MB javax.media.j3d.BranchGroupRetained: 100.000 =========================================================================== 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".