<Newbie> - HUGE memory usage for small web app?

Hey guys - thanks for reading a newbie post.

I am fairly well-versed in Java, and new to Java 3D. I have started a project to connect a 3D representation of the earth with information in a database. Eventually, I want to have a zoom-able globe, where the user can select points and attach information to them. The info will then be stored in a PostgreSQL db.

But all that I currently have is a small demo, with a spinning earth. You can find it at http://www.the-athenaeum.org/javatest/earthtest.php

I can post the code if you like, but basically it is EarthApp.java from the texture tutorial (chapter 6) with the most recent version of Java 3D. I have changed the code to work on a web site (ie, loading the file from a URL rather than a file object), made the display size a bit bigger, and switched in a higher resolution JPEG from NASA.

Here’s my problem. The JPEG I’m using is 302KB. But when I run the application (which just has one spinning sphere object mapped with that one texture), it appears to suck up 70MB of memory! I am guessing this by watching Mozilla’s memory in the Windows 2000 task manager. It starts off at about 20-25MB. But when I load the page with my demo, it shoots up to about 95MB. I also doesn’t appear to let go of the memory when I close the page (it finally releases the memory when I close Mozilla completely).

I am independently looking at some of the optimization pages out there, but there are a lot of topics to go through. Could some of you guys get me started on understanding:

  1. How to get a rough estimate of “reasonable” memory usage based on the number of objects, size of textures involved, etc.

  2. What “obvious” optimizations might get rid of my “dumb mistakes”.

Like I said, I am also looking elsewhere, but I thought your experience could give me a head start. I can also post the complete code if that will help.

Thanks in advance for helping a newbie,
Chris McCormick

This is pretty much common behaviour for j3d, it tends to land-grab large amounts of memory - even for small apps. This mainly seems to be that it was intended to scale well, so you could probably test a huge scene and get only a minimal increase in memory. Theres also a known bug where it will not release the memory properly on exit which you may be stumbling across, (anyone know if this is fixed yet?).

In short, don’t worry about it yet. Keep an eye on the memory usage as you extend your app and you’ll probably not see much of an increase…

well I see nothing normal about that - and would not right away blame it on java3d - I am running one of my terrrain demos and using (1) texture 1.4 Meg on it and it starts with 25 Meg and stays that way until I close it …in other demo I am getting about same amount of memory consumption but I am loading 256 terrain tiles(shapes3d) each having 2 textures - so it amount to at least 20times more then you are using …

If you take a look over at http://www.j3d.org you will find a set of tips to maximise performance with Java 3d. I’m not sure whether there is anything there that helps this specifically but it will probably explain it somewhere.