Glenn,

Can you please send a simple test program to [EMAIL PROTECTED] ?

PS: code fragments will not be look at due to resource constraint.


- Chien Yang Java 3D, Sun Microsystems Inc.




Glenn Pinkerton wrote:


Hello again,

Thanks for the pointers, but unfortunately none of them
helped solve the memory leak problem.

I changed the code to use a VirtualUniverse instead of a
SimpleUniverse, but the problem still persists.  The scene has
about 25000 triangles, rendered using transparency and also
rendered with opaque wireframe.  If I do not add the canvas3d
to the view, but I still build all the shape3d objects and add them
to the scene, there is no memory leak.  The leak, of about
5 megabytes per iteration, occurs when the scene is actually
drawn.

I am definately using version 1.3.1 of java3d, and I have implemented
the cleanup features pertinent to the contents of a VirtualUniverse as
suggested in the threads mentioned below.

Ultimately, I need to have an interactive 3d view where anything in the
view (including the entire view) can be edited, deleted, replaced, etc at
the users wish.  The work I am doing now is just to explore how to do
such things with java3d.  If there are other better ways to allow wholesale
changes in the 3d scene that also avoid this memory leak, I'd be happy to
hear about them.

Thanks,

Glenn

Here are relevant code fragments for what I am currently doing.

   J3DPanel ()
   {
       setLayout (new BorderLayout());
       GraphicsConfiguration config =
           SimpleUniverse.getPreferredConfiguration ();
       canvas = new Canvas3D(config);
       add (BorderLayout.CENTER, canvas);
       vuniverse = new VirtualUniverse ();
       locale = new Locale(vuniverse);

       BranchGroup    bgvp = new BranchGroup ();
       TransformGroup tg = new TransformGroup ();
       viewPlatform = new ViewPlatform ();
       tg.addChild (viewPlatform);
       bgvp.addChild (tg);
       locale.addBranchGraph (bgvp);

       view = new View ();
       PhysicalBody pb = new PhysicalBody ();
       PhysicalEnvironment pe = new PhysicalEnvironment ();
       view.setPhysicalBody (pb);
       view.setPhysicalEnvironment (pe);

       view.setFrontClipDistance (.01);
       view.setBackClipDistance (100.0);

       //view.setTransparencySortingPolicy
(View.TRANSPARENCY_SORT_GEOMETRY);
       //view.setScreenScalePolicy (View.SCALE_EXPLICIT);

view.attachViewPlatform (viewPlatform);

   /*
    * If the canvas is never added, nothing is drawn but there
    * is also no memory leak.
    */
       view.addCanvas3D (canvas);

}

   private void cleanup ()
   {
       if (vuniverse != null  &&  view != null) {
           System.out.println ("3d cleanup called");
           System.out.flush ();
           view.removeAllCanvas3Ds ();  // added at suggestion of the
discussion threads mentioned below
           vuniverse.removeAllLocales ();
           vuniverse = null;
           locale = null;
           canvas = null;
           view = null;
           viewPlatform = null;
           System.gc();
       }
   }

----- Original Message -----
From: "White Morph" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 09, 2003 6:52 AM
Subject: Re: [JAVA3D] major memory leak


Hi,


Here are some threads that may help you:

http://archives.java.sun.com/cgi-bin/wa?A2=ind0306&L=java3d-
interest&D=1&O=A&P=83264

http://archives.java.sun.com/cgi-bin/wa?A2=ind0306&L=java3d-
interest&D=1&O=A&P=50300

---white

===========================================================================
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".

Reply via email to