I tried the profile, and results were very confusing. In fact, my
objects and some Java3D objects used a little memory and most of them
were correctly garbage collected. In fact (and I make the sum) all my
objects and Java3D objects only used 12MB of memory (that's what the
profiler reported).

I think there is other kind of problem. Maybe something with the
off-screen buffer. I've tried this but it didn't worked:

http://forum.java.sun.com/thread.jspa?forumID=21&threadID=319824

The problem is that I need to show a 3d preview of the distributions
of boxes in two different places of the application and I have to
generate a report with some screenshots of the distribution, so all
this "memory leak like" problem is a big problem. And I really don't
have any idea of what may be happening and made all the memory
optimization that were at hand :-(

Thanks, DemiÃn

On Tue, 23 Nov 2004 13:16:35 -0500, Mike Pilone <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> One suggestion is to run your application in a profiler so you get a better
> idea of what is using the memory. There are a few of them out there, but
> http://www.ej-technologies.com/download/jprofiler/trial.php is one I
> recommend. You can get a 10 day trial from the link above.
> 
> I have had trouble with creating a lot of J3D objects due to the use of
> finalizers. If the finalization thread doesn't run fast enough you will run
> out of memory. You should consider reusing as many objects as possible as
> well. All of this is just best guessing until you run a profiler.
> 
> -mike
> 
> 
> 
> 
> > -----Original Message-----
> > From: Discussion list for Java 3D API [mailto:JAVA3D-
> > [EMAIL PROTECTED] On Behalf Of Demian Gutierrez
> > Sent: Tuesday, November 23, 2004 12:37 PM
> > To: [EMAIL PROTECTED]
> > Subject: [JAVA3D] Big OutOfMemory problem
> >
> > Hello (forgive my english)
> >
> > First: I'm sooner or later ending with a java.lang.OutOfMemoryError
> >
> > I'm making an application to display boxes packed in a pallet/container.
> > The
> > scene I'm creating is like this:
> >
> >          BG(1)
> >           |
> >          TG(2)
> >          /  \
> >         /    \
> >     (3)BG    BG(4)
> >       /  \
> >      /    \
> >  (5)BG .. BG(6)
> >
> > 1.- Root BranchGroup.
> > 2.- TransformGroup (to handle rotations).
> > 3.- A BranchGroup containing all boxes.
> > 4.- A BranchGroup containing the container shapes.
> > 5 to 6.- Classes (instances) that extends from BranchGroup) that creates
> > all
> > the shapes of a box.
> >
> > From 5 to 6 can be from 1 to 4000 nodes, where each node is a box created
> > with 6 shapes 3d. The code is something like:
> >
> > public class VBox extends BranchGroup {
> >
> > // ... Not important
> >
> >   private void createGeometry(Appearance appearance1) {
> >     // Create QUADS (Once for each face), The p3fArray and
> >     // the Point3f inside are statics And shared by all boxes
> >     p3fArray[0].set(xmin, ymin, zmax);
> >     p3fArray[1].set(xmin, ymax, zmax);
> >     p3fArray[2].set(xmin, ymax, zmin);
> >     p3fArray[3].set(xmin, ymin, zmin);
> >     addChild(createQuad(p3fArray, appearance1));
> >     addChild(createQuad(p3fArray, appearance2));
> >     // The code above is repeated once for each face of the box
> >   }
> >
> >   private Shape3D createQuad(Point3f[] p3f, Appearance app) {
> >     QuadArray quadArray = new QuadArray(4, QuadArray.COORDINATES);
> >     quadArray.setCoordinates(0, p3f);
> >
> >     Shape3D ret = new Shape3D();
> >     ret.setAppearance(appearance);
> >     ret.setGeometry(quadArray);
> >
> >     return ret;
> >   }
> > }
> >
> > I'm sure that this object is being eventually garbage collected (I
> > override
> > finalize to find this out) and the QuadArray and Shape3D are being
> > finalized
> > too. Appareance, Color3f, etc, objects and all it's attributes are static
> > or
> > shared, so the OutOfMemory does not comes from there. I'm sure that the
> > non
> > Java3D code is optimized and does not waste memory and it's not the cause
> > of
> > the problem.
> > I'm able to load and see some boxes distributions, but memory gets
> > increased
> > when I change the solution being displayed and sooner or later I get the
> > OutOfMemory.
> >
> > Nodes 1 and 2 are always present. To change a "boxes distributions" I just
> > detach nodes 3 and 4 (the old distribution) and attach the nodes right
> > nodes
> > for the "new current distribution". I'm sure that there isn't a reference
> > to
> > old nodes 3 and 4 after that (in fact my VBox objects gets finalized). I
> > also added System.gc() calls in critical parts and the situation gets
> > better
> > but after browsing some distributions I still get the OutOfMemory (and the
> > performance gets very bad)
> >
> > At the point before display a distribution the applications has 23MB of
> > memory. After the first 5 distribution it has 65MB after 10/15 it has
> > almost
> > 97MB and from that point I can view some distributions but if I try to see
> > a
> > big one (1000 boxes or more) I get the OutOfMemory.
> >
> > I also tried with the JVM option âXincgc and the situation gets
> > controlled,
> > but the performance is very bad.
> >
> > I heard about problems with the SimpleUniverse being created and destroyed
> > and I tried both approaches: 1.- Keep a singleton, 2.-create and cleanup()
> > the SimpleUniverse each time I change a distribution. With both I have the
> > same problem.
> >
> > I really don't know what else to do. If any body has a suggestion or If
> > I'm
> > doing something wrong I would appreciate the help.
> >
> > Thanks, DemiÃn.
> > 
> > ==========================================================================
> > =
> > 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".

Reply via email to