Moin > KRK in his problem got the out of memory problem only > after repeated additions and deletions from his branch group
Look at: [JAVA3D] Memory leakage when detaching content (was: [JAVA3D] What happened?) send from Andre Bialojahn <[EMAIL PROTECTED]> on 2004-04-14 22:43 start quote: (...) The visualisazion itself went fine, but when I came across unloading the data from my simple viewing program that I used for testing and playing around with J3D - I had my memory leak out in handy chunks of about 140 to 350 megs. :-) Jip, /megs/. (...) So I started digging *deep* with <http://www.jb2works.com/>'s "Reference Scanner" and found out that the SG stayed cached in J3D's internal structures. stop quote That is the ONLY REALLY SURE FACT that is repeated in all good in-deep-examinations about the frequent-SG-remove/change = mem-leak = OutOfMemory problem. The j3d-side keeps references to the old scenegraph and the "native" part of the SG does not get reclaimed/unloaded. Now we enter the funny world of speculation. There are serval "theories" about how to get rid of it: 1. the "simple" way: Remove the the stuff you want to remove from the node. Remove the rest of the stuff attachted to the same node. Create a new empty BranchGroup. add it to the node and remove it again. add the rest again to the node. The theorie said that by adding something to a empty node you would start a "rebuild" of that node and, in the process, getting rid of all old references. I have seen that one in several variantes, some leaving the rest in, some using 2 BranchGroups, some saying you had to do it in 1 frame, some saying it doesn't work with mulitple canvas .... 2. His way: start quote: (...) I still don't know /what/ finally fixed my leakage, but I strongly suspect that after detaching my content the call to compile() did the trick. The API-Dox say something like "...rebuilds internal caches". (...) What do I do in my program? * Use a SimpleUniverse * setup the static content branch in a BranchGroup. This part  features a "hook" where I am able to attach and detach my dynamic  content. Initially this BG is left empty until the user loads  something. * add the static part to the scene * add the scene to the universe * compile() all When it comes to removing, I have found the following to work for me: * manually(!) and explicitly destroy *each and every* node in the  SG, clean up every field in every instance, set everything null.  Yes, this might become more than a little bit annoying. After this is being done, I execute this: [Codesnippet] - simpleUniverse.getLocale().removeBranchGroup(scene) - scene.hookPoint.removeChild(<dynamic content>) - <dynamic content>.detach() - scene.compile() - disposal of the PickCanvas - simpleUniverse.getLocale().addBranchGraph(scene) When it comes to (re-)inserting content, this works fine for me: - scene.hookPoint.addChild(<dynamic content>) - setup PickCanvas OBTW: OS: W32, J2SDK: 1.4.1_01, J3D: 1.3.1, DirectX It might even have helped to upgrade J3D from 1.3 to 1.3.1, as I've found some bug remark addressing removal of nodes. (...) stop quote I have not tested it, but up until now it seems to work for him. good luck. Gilson Laurent =========================================================================== 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".