Kelvin,

FYI - as promised here is my update to this issue:

I can confirm that (2) is indeed fixed in 1.3.1beta - thanks for pointing this
out to me.

I am still getting substantial garbage collection pauses - around 1.5 seconds.
(3) is indeed an offender, but it is only one of a largish number (maybe a
dozen) of allocation sites that are generating what I would term 'significant'
garbage.

If you'd like me to supply stack traces of these sites, please let me know.

Rob



Rob Nugent wrote:
Kelvin,

Many thanks for the detailed clarification. As you probably guessed, I
don't have 1.3.1beta on my PC at home yet. I'll get it upgraded and
check 2) is fixed. It's great that you folks have got this one already -
apologies for the false alarm. It was certainly arrays of 4 doubles that
were the greatest garbage.

Once I've upgraded, I'll check for the impact of 3) in terms of what GC
pauses I'm getting, and I'll report back.

Thanks again for all your attention to this !

Rob

Kelvin Chung wrote:

Hi Rob,

   Here is an investigation some more investigation of this problem.

(1)

Bug 4740086 - Picking cause lots of GC in PickShape intersect() routine

apply only to (A) PickCylinderRay (B) PickConeRay (C) PickConeSegment
only.They are not recommend to use for collision detection.
Recommend workaround is to using PickRay/PickSegment instead.


(2)

In J3D v1.3.1 beta1, intersectRay() and intersectSegment() is
rewritten to use another algorithm. As a result the two lines
in v1.3 release

   double uCoor[] = new double[4];
   double vCoor[] = new double[4];

that used to allocate 8 double every time is removed. So upgrade to
v1.3.1 beta1 should solve it.

(3)
  For GC cause by

    javax.media.j3d.Transform3D.<init>(Transform3D.java:87)
       javax.media.j3d.SceneGraphPath.<init>(SceneGraphPath.java:61)
       javax.media.j3d.Picking.getSceneGraphPath(Picking.java:362)
       javax.media.j3d.Picking.pickAllSorted(Picking.java:88)
       javax.media.j3d.Locale.pickAllSorted(Locale.java:599)
       rob.kit.KitUtilities.pick(KitUtilities.java:64)

 This is a limitation of current API
 public SceneGraphPath[] pickAllSorted( PickShape pickShape )

as you can see we have to create a new SceneGraphPath object ( which
indirectly create a new Transform3D ) and return to the user.
Unless API change to pass this object in the future we have to let
JVM do the job of GC.


Thanks.

- Kelvin
-------------------
Java 3D Team
Sun Microsystems Inc.









Rob Nugent wrote:

Hello,

I've recently started adding substantial quantities of extra geometry
to my
application, and I'm starting to see horrible garbage collection pauses,
typically around *2 seconds* and sometimes more.

(I'm ataching a screen shot to illustrate the complexity of my scene).

I've tried to be careful not to generate garbage, so I investigated
using
'-Xrunhprof:heap=sites' to find the culprit. The results seem to point
primarily
at Shape3D.intersect(), although there is some evidence that
Locale.pickAllSorted()is also an offender.

I make *extensive* use of these routines each time a frame is rendered
(tens of
calls per frame), primarily in order to do collision detection. I use
PickRays
and PickSegments on my geometry based picks.

Here's the hprof evidence from an extended run under Win2K:

...
TRACE 15431:

javax.media.j3d.GeometryArrayRetained.intersectRay(GeometryArrayRetained.java:7182)


javax.media.j3d.TriangleStripArrayRetained.intersect(TriangleStripArrayRetained.java:57)


javax.media.j3d.Shape3DRetained.intersect(Shape3DRetained.java:651)
        javax.media.j3d.Shape3D.intersect(Shape3D.java:540)

...
TRACE 15430:

javax.media.j3d.GeometryArrayRetained.intersectRay(GeometryArrayRetained.java:7181)


javax.media.j3d.TriangleStripArrayRetained.intersect(TriangleStripArrayRetained.java:57)


javax.media.j3d.Shape3DRetained.intersect(Shape3DRetained.java:651)
        javax.media.j3d.Shape3D.intersect(Shape3D.java:540)
...
TRACE 15460:

javax.media.j3d.GeometryArrayRetained.intersectSegment(GeometryArrayRetained.java:7426)


javax.media.j3d.TriangleStripArrayRetained.intersect(TriangleStripArrayRetained.java:83)


javax.media.j3d.Shape3DRetained.intersect(Shape3DRetained.java:634)
        javax.media.j3d.Shape3D.intersect(Shape3D.java:579)
...
TRACE 15459:

javax.media.j3d.GeometryArrayRetained.intersectSegment(GeometryArrayRetained.java:7425)


javax.media.j3d.TriangleStripArrayRetained.intersect(TriangleStripArrayRetained.java:83)


javax.media.j3d.Shape3DRetained.intersect(Shape3DRetained.java:634)
        javax.media.j3d.Shape3D.intersect(Shape3D.java:579)
...
SITES BEGIN (ordered by live bytes) Tue Feb 11 21:39:50 2003
          percent         live       alloc'ed  stack class
 rank   self  accum    bytes objs   bytes objs trace name
    1 10.11% 10.11% 11393088 237356 796515264 16594068 15431 [D
    2 10.11% 20.23% 11393088 237356 796515264 16594068 15430 [D
    3  5.75% 25.98%  6474624 15564 6474624 15564  5738
javax.media.j3d.QuadArrayRetained
    4  4.15% 30.13%  4680048 97501 1834835136 38225732 15460 [D
    5  4.15% 34.29%  4680048 97501 1834835136 38225732 15459 [D
...

Look at the 'Allocated Bytes' column and compare with the 'live bytes'
column.
This suggets to me that these routines have generated about *5
Gigabytes* of
garbage during my run. The 'live' data seems to be occupying 30% of my
heap, or
about 30MBytes, which is a huge overhead.

So, to my Sun Colleagues,

1) Would you consider this to be a bug ?
2) Is there anything that your could do about this ? I'm wondering if
there
might even be some temporary storage that you are allocating that you
could
release earlier(i.e. null out), which might give the generational
garbage
collector the opportunity to reclaim more efficiently.

I have to say that the rendering and picking performance for my app is
extremely
good, but this garbage problem is starting to kill me.

I also suspect from other tests that largish amounts of garbage are
being
generated at the following location:
        javax.media.j3d.Transform3D.<init>(Transform3D.java:87)
        javax.media.j3d.SceneGraphPath.<init>(SceneGraphPath.java:61)
        javax.media.j3d.Picking.getSceneGraphPath(Picking.java:362)
        javax.media.j3d.Picking.pickAllSorted(Picking.java:88)
        javax.media.j3d.Locale.pickAllSorted(Locale.java:599)
        rob.kit.KitUtilities.pick(KitUtilities.java:64)


Rob
--


Rob Nugent
Sun Microsystems, Southampton, UK

[EMAIL PROTECTED]

Tel: +44 (0) 1489 585503
Fax: +44 (0) 1489 881363

------------------------------------------------------------------------


===========================================================================

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

--


Rob Nugent
Sun Microsystems, Southampton, UK

[EMAIL PROTECTED]

Tel: +44 (0) 1489 585503
Fax: +44 (0) 1489 881363

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