Link to home
Start Free TrialLog in
Avatar of sis5
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
Avatar of Tommy Braas
Tommy Braas
Flag of Australia image

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
Avatar of Tommy Braas
Tommy Braas
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mayank S
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.
It was just a thought, in case he starts getting OutOfMemory errors later.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial