By default, the Primitive utilities keep a cache of the geometry defined for a primitve so that the geometry may be shared among primitives. This cached reference is being kept around, so that is probably why you see the leak. Create the primitve with Primitve.GEOMETRY_NOT_SHARED to turn off this feature.
Doug Twilleager Java 3D Team Sun Microsystems >Subject: [JAVA3D] Memory Leak in Cylinder Geometry Update >To: [EMAIL PROTECTED] >MIME-version: 1.0 >Delivered-to: [EMAIL PROTECTED] > > Dear members, > > I am having a problem in my java3d code. > suppose I want to place a Cylinder in my > virtual universe and I want to change its > length. to do so, I construct a new Cylinder > with the new properties. then I get its geometry > and set the old cylinder's geometry to the new one. > > a pseudocode is something like this: > > Cylinder newCylinder = > new Cylinder(blah, blah, blah...); > > newCylinder.getShape(Cylinder.BODY).setCapability > (Shape3D.ALLOW_GEOMETRY_READ); > newCylinder.getShape(Cylinder.BODY).setCapability > (Shape3D.ALLOW_GEOMETRY_WRITE); > > (and the same lines for Cylinder.TOP and > Cylinder.BOTTOM) > > oldCylinder.getShape(Cylinder.BODY). > getGeometry(geom); > oldGeom = null; > newCylinder.getShape(Cylinder.BODY). > getGeometry(geom); > oldCylinder.getShape(Cylinder.BODY). > setGeometry(geom); > > newCylinder = null; > geom = null; > > (and again, the same lines for Cylinder.TOP and > Cylinder.BOTTOM) > > clear and simple. but, unfortunately, i face an > unpleasing memory leak. I have no time at this > moment for further investigations with JProbe or > JOptimizeIt and I'm composing this letter > in a big hurry! Any comment or help is > much appreciated! I'll be glad to hear better > and faster ways or a way to prevent memory > leaks! > > Sincerely, > Mehrtash > > >__________________________________________________ >Do You Yahoo!? >LAUNCH - Your Yahoo! Music Experience >http://launch.yahoo.com > >=========================================================================== >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".
