sis5
asked on
Small Java program taking up absurb amount of memory!!
Hello.
I created a small Java application, basically a simple calculator to calculate interest.
There's only about 400 lines of code, no complex structure (only your basic types: int, long, float etc), just one JFrame and several jTextFields, but to my horror the program takes up over 20 MB of memory!!!!
Any help would be appreciated.
Thanks
I created a small Java application, basically a simple calculator to calculate interest.
There's only about 400 lines of code, no complex structure (only your basic types: int, long, float etc), just one JFrame and several jTextFields, but to my horror the program takes up over 20 MB of memory!!!!
Any help would be appreciated.
Thanks
Hmmm, you have to start the JVM. The JVM takes up some memory. Out of the 20MB you're seeing used, your program probably doesn't take up more than 4MB. UI resources are expensive as memory has to be allocated for every pixels in a frame, plus loose stuff around it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can increase the amount of memory that the JVM uses by setting the -Xmx option while running your program.
>> You can increase the amount of memory that the JVM uses by setting the -Xmx option while running your program.
That wasn't the question.
That wasn't the question.
It was just a thought, in case he starts getting OutOfMemory errors later.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
=-)