Hello everybody, I'm comming with some new facts. I can confirm now that in immediate mode, the garbage collector doesn't have any problems in collecting shared geometries. No memory leaks.
So, I'm asking again, since there was no answer before, what's happening when a scenegraph is made live that shared geometries are not released for garbage collection ? Is it a bug or am I doing something wrong ? Hope that somebody from the j3d team will have a little time to answer, because no answer is sometimes the worst answer. Kind Regards, Florin -----Urspr�ngliche Nachricht----- Von: Florin Herinean Gesendet: Donnerstag, 6. M�rz 2003 17:29 An: 'Discussion list for Java 3D API' Betreff: AW: [JAVA3D] ? Garbage Collection - memory does not decrease ? For me that looks like a real bug! Please j3d guys explain so that I understand what's happening. I've done today intense testing and I saw that whenever 2 or more shapes share the same geometry, that memory is never recollected. My app makes intense use of sharing geometry (I have a geometry cache for speeding up loading time and keeping memory low) and I was wandering why I have memory leaks. Thanks to Mariusz for pointing that out! Running the app with -verbosegc and invoking System.gc() after every load showed me a constant increase of memory, the full gc not being able to collect the memory. Even if I clear the geometry cache just before calling gc(), it makes no difference. [Full GC 41787K->40592K(66304K), 1.0520049 secs] <-- 1 MB collected, steady memory increase by aprox. 6 MB each reload Disabling the geometry sharing (the geometry is not picked from the cache but reread from the file) showed after an initial memory increase (first 5 - 6 reloads) that the full gc was able to collect large amount of garbage, keeping the memory usage at a constant value. [Full GC 28969K->21797K(40400K), 0.8265302 secs] <-- 8 MB collected, no memory increase Please note that I'm not using any of the j3d primitives, although the behavior is just the same. The memory leaks occured only if the scene graph is made live! If I'm creating the scenegraph using shared geometries but *not* add it to the universe (just dropping it), there are no memory leaks. I can see the garbage collector successfully kicking in. [Full GC 5688K->3350K(6536K), 0.2916130 secs] <-- 2.3 MB collected, no memory increase All examples used the same model. Kind Regards, Florin -----Urspr�ngliche Nachricht----- Von: Sean Sylvis [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 5. M�rz 2003 19:46 An: [EMAIL PROTECTED] Betreff: Re: [JAVA3D] ? Garbage Collection - memory does not decrease ? I believe only the objects in the com.sun.j3d.util.geometry package implement this capability. Other objects should be GCed when removed from the scene graph as expected. Sean > -----Original Message----- > From: ZACZEK, MARIUSZ P. (MARIO) (JSC-DM) (NASA) > [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 05, 2003 10:41 AM > To: [EMAIL PROTECTED] > Subject: Re: [JAVA3D] ? Garbage Collection - memory does not > decrease ? > > > Good point...that did make the garbage collection work > although it causes > you to have > a much larger memory hit from the start since you are not sharing the > geometry. > > But, though this may be a partial solution (or tradeoff) for > Java3D objects > that have > this capability, what about things that don't have a default sharing > capability? > Or do all nodes share info? > > Mario > > > > -----Original Message----- > From: Sean Sylvis [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 05, 2003 12:13 PM > To: ZACZEK, MARIUSZ P. (MARIO) (JSC-DM) (NASA) > Cc: Discussion list for Java 3D API > Subject: RE: [JAVA3D] ? Garbage Collection - memory does not > decrease ? > > > > By default, the Sphere class (and all of the Primitives) share their > geometry. The Sphere class maintains a reference to that > Sphere geometry so > it can be shared when another Sphere with the same properties > is desired. > So, even if you remove the Sphere from the scene graph, it > will not be GCed. > You must set the GEOMETRY_NOT_SHARED capability flag on > Sphere construction > if you do not want this behavior. > > Sean > > > -----Original Message----- > > From: ZACZEK, MARIUSZ P. (MARIO) (JSC-DM) (NASA) > > [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, March 05, 2003 8:49 AM > > To: [EMAIL PROTECTED] > > Subject: [JAVA3D] ? Garbage Collection - memory does not decrease ? > > > > > > Below is a copy of a post someone put to this group in > > 1998!!! There was no > > answer > > in that thread and searching the archives I have not yet found an > > answer...so, I'm > > going to ask you all about it. Do you know how to get back > > the memory after > > removing > > a child from a parent? > > > > I run my code where I have a function to add 3D spheres to a > > 3D canvas: > > > > void addSpheres() { > > for (int i=0; i<1000; i++) > > mainBranchGroup.addChild(new sphere(...)); > > } > > > > Later on I remove the spheres: > > > > void removeSpheres() { > > mainBranchGroup.removeAllChildren(); > > } > > > > BUT, running java -verbose:gc myProgram > > Shows NO decrease in memory....I only see a steady increase > > in memory used > > as I add more > > spheres, but if I remove them I don't see any memory decrease. > > > > I am quite confident I have NO reference to the new sphere() > > anywhere else > > so I don't see > > why the memory should not be released....any > > hints/thoughts/suggestions? ... > > or is this > > a persistent problem in Java3D? > > > > I've also tried the System.gc(); call periodically but I > > find that it does > > nothing for me... > > and by the Javadocs for it I can see that this call MAY or > MAY NOT do > > anything...kind of wierd. > > > > Thanks, > > > > Mario > > > > > > > > >> -----Original Message----- > > >> From: Jon Barrilleaux [SMTP:[EMAIL PROTECTED] > > >> Sent: Friday, October 09, 1998 2:25 PM > > >> Subject: [java3d] garbage collection after removing nodes > > >> > > >> Someone reported on this list a while back that memory was > > not being > > >> freed after releasing a large number of Group nodes. I > > never saw an > > >> answer to this on the list. > > >> > > >> I've observed a similar problem. I create a large scene in a > > >> BranchGroup and add it to my scene. Memory usage goes up. After > > >> removing it from its parent BranchGroup and then running > > System.gc() > > >> the memory usage does not change. I'm pretty sure that I > > don't have a > > >> lingering reference. Repeating this cycle of adding a new > > scene graph > > >> and then removing it only causes the memory size to grow. > > >> > > >> Is this a known bug or am I missing something? > > >> > > >> --jon > > > > > > > > > > Mario > > > > Mariusz Zaczek > > NASA - Johnson Space Center > > Automated Vehicles and Orbit Analysis / DM35 > > Flight Design and Dynamics Division > > Mission Operations Directorate > > Bldg: 30A Room: 3040A > > > > Disclaimer: "The opinions, observations and comments > > expressed in my email > > are strictly my own and do not necessarily > > reflect those of > > NASA." > > > > ============================================================== > > ============= > > 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". > > > > ============================================================== > ============= > 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". > ==========================================================================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". ==========================================================================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".
