Java memory footprint ...

An old one this - but I haven’t been around Java for about 6 months.

Are Sun doing anything about the memory footprint of Java (esp. Swing) apps? I just loaded up SwingSet2 under JRE1.4.1_01, only to be appalled to see 69MB of memory being swallowed up. And this app doesn’t even do anything useful! This is unreal.

:frowning:

No, it’s real. But this is a biased value. We have a really large Java/Swing app satisfied with 64MB as well. So don’t be afraid.

Microsoft Word is a behemoth of an application, but I note that it only takes up 8MB when loaded…

The general Java overhead is still quite high and one of Swing’s Achilles’ heels is the fact that it creates so much stuff for an apparently very simple end result.

My game takes up 21.5MB so far while it’s running and there’s not even a teeny bit of AWT in it. Only about 6MB of that is heap; there’s 1MB of sound, 1MB of graphics, a few MB of .DLLs for OpenGL etc, and 3MB for (my) bytecode. Then there’s rt.jar classes and VM overhead: compiled code, hotspot profiling information, a bit of free heap, some stack, and the Sun .dlls. If I added a Swing front end to it I can see my memory requirements doubling and no longer being able to fit comfortably on a low-end machine.

There’s a rumour that we’ll get a Java execution service with the 1.5 release which will move all executing Java code into one process and cut most of that overhead out for concurrent executions but that doesn’t cut the straight-up 6MB overhead that you can’t escape from. Here’s hoping…

Cas :slight_smile:

What do we learn? If you make a Java app, make a big one! Better don’t make a set of tiny utilities…

:smiley: ::slight_smile: ;D

Cas :slight_smile:

Looks like you can’t write a small application, so I’d have to agree with that.

:slight_smile: