aspose file tools*
The moose likes Performance and the fly likes Java Swing App == Lots of consumed memory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "Java Swing App == Lots of consumed memory" Watch "Java Swing App == Lots of consumed memory" New topic
Author

Java Swing App == Lots of consumed memory

Thomas Mcfarrow
Ranch Hand

Joined: Jul 09, 2001
Posts: 137
Hi,

I am writing a java POS application that is loaded with a ton of buttons (used in touch screen environment). Total JButtons(I use setIcon, setPressedIcon, etc) are about 1k throughout the various screens. Memory usage goes over 100MB, does this seem normal?

I currently cache the buttons in order to speed up the application. Furthermore, according to configuration by the user, I will hide / show the buttons and constantly change the icons on the buttons.

I am using Eclipse and TPTP. I see for the memory analysis that "int" is using like 65 MB.

Please someone help!

Thanks
[ January 10, 2007: Message edited by: Thomas Mcfarrow ]
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Originally posted by Thomas Mcfarrow:
Total JButtons(I use setIcon, setPressedIcon, etc) are about 1k throughout the various screens. Memory usage goes over 100MB, does this seem normal?

Not to me.
I wrote a simple MassButtonApplication, and may start it with
(for 100x100 = 10 000 Buttons).
or
(for 2x2 = 4 Buttons).
Do you have one Listener per Button?

Originally posted by Thomas Mcfarrow:

I currently cache the buttons in order to speed up the application. Furthermore, according to configuration by the user, I will hide / show the buttons and constantly change the icons on the buttons.

Well 1000 Icons are another issue.
How big are those Icons?
100 MB / 1000 Buttons would be 100 000 bytes/ Button - seems too much to be explained by iconsize, colordepth and imageformat.



http://home.arcor.de/hirnstrom/bewerbung
Thomas Mcfarrow
Ranch Hand

Joined: Jul 09, 2001
Posts: 137
All together there are about 10 static listener objects that listen for button activity.

Icon size is under 5KB for each state (icon, pressed, disabled). Total under 20KB. Worst case scenario is 20MB in graphics
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Swing App == Lots of consumed memory
 
Similar Threads
Java swing
Static / Dynamic JButtons and JPanels
Idle java application eating memory
OutOfMemoryError
how can we write memory resident program