I am recursively setting the Appearance to new Apearance()  now for all my
shape nodes:


   /**
    * Sets the appearance of every shape to a new appearance so they
    * can release shared items and be garbage collected
    */
   private void resetAppearance( Node node ) {

      if (node instanceof Group) {

         Group g = (Group)node;
         for (int i=0;i<g.numChildren();i++) {
            Node n = g.getChild(i);
            resetAppearance(n);
         }

      } else if (node instanceof Shape3D) {

         Shape3D s = (Shape3D)node;
         s.setAppearance(new Appearance());

      }
   }

  It helped but not enough.  Here is more info:

  2  2.89%  9.51%   257904 3582  257904 3582  6676
javax.media.j3d.Shape3DRetained
    3  2.42% 11.93%   216040 2455  315568 3586  5906
javax.media.j3d.TriangleStripArrayRetained
    4  1.83% 13.75%   163512 2271  257904 3582  5959
javax.media.j3d.Shape3DRetained

Note that item 4 was allocated 3582 times, with only 2271 remaining.
Clearly its being deallocated.  But item 2 was allocated 3582 times and is
never being allocated.

Item 4 is:

TRACE 5959:
 javax.media.j3d.Shape3D.createRetained(Shape3D.java:154)
 javax.media.j3d.SceneGraphObject.<init>(SceneGraphObject.java:60)
 javax.media.j3d.Node.<init>(Node.java:123)
 javax.media.j3d.Leaf.<init>(Leaf.java:31)
 javax.media.j3d.Shape3D.<init>(Shape3D.java:116)

com.xith.java3d.geometry.terrain.mesher.TriangleMesher.getMesh(TriangleMeshe
r.java:333)

The above is my code call to make the shape, this makes sense.


TRACE 6676:
 javax.media.j3d.Shape3DRetained.setLive(Shape3DRetained.java:1102)
 javax.media.j3d.GroupRetained.doSetLive(GroupRetained.java:1475)
 javax.media.j3d.BranchGroupRetained.setLive(BranchGroupRetained.java:101)
 javax.media.j3d.GroupRetained.checkSetLive(GroupRetained.java:1009)
 javax.media.j3d.GroupRetained.checkSetLive(GroupRetained.java:869)
 javax.media.j3d.GroupRetained.doAddChild(GroupRetained.java:431)

Looks like setLive is allocated a Shape3DRetained for every Shape3d I make.
Is this a compiled geometry?  I don't know, but its NEVER going away.

Any help is appreciated.


----- Original Message -----
From: David <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 06, 2000 7:15 AM
Subject: [JAVA3D] Memory Leak?


It looks like my shapes are not being released to garbage collection after a
detach:

TRACE 6671:
 javax.media.j3d.Shape3DRetained.setLive(Shape3DRetained.java:1102)
 javax.media.j3d.GroupRetained.doSetLive(GroupRetained.java:1475)
 javax.media.j3d.BranchGroupRetained.setLive(BranchGroupRetained.java:101)
 javax.media.j3d.GroupRetained.checkSetLive(GroupRetained.java:1009)
 javax.media.j3d.GroupRetained.checkSetLive(GroupRetained.java:869)
 javax.media.j3d.GroupRetained.doAddChild(GroupRetained.java:431)


SITES BEGIN (ordered by live bytes) Wed Sep 06 07:02:48 2000
          percent         live       alloc'ed  stack class
 rank   self  accum    bytes objs   bytes objs trace name
    1  7.01%  7.01%   591892  157  591892  157     1 [I
    2  3.33% 10.34%   281304 3907  281304 3907  6671
javax.media.j3d.Shape3DRetained


Notice that there are as may live objects as were ever alocated?  This means
that never, in the course of my run, did one Shape3DRetained get released.
I am dropping my reference to them after detaching, so I would expect them
to go away.  I know there is a bug with Shapes not being released with
shared Appearance (4182781 Shape3D memory not freed when unassigned if
associated appearance object isalive ).  But I assumed that was a shared
Appearance() object, not a sub object.  All my shapes share material and
texture objects, which is necessary and correct that they do so.   Don't I
just detach branchgroups and let them die? or do I need to make them
"unalive" somehow?

By the way... when is the next version of Java3d going to be made available?

Dave Yazel

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