Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Swing App == Lots of consumed memory

 
Thomas Mcfarrow
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Thomas Mcfarrow
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic