Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

50 MB RAM normal for 1500 lines of code?  RSS feed

 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I have a program with 1500 lines. There are some JPanels(6 or more), 3 threads, a mySQL and ftp connection, a comlex dialog and a property file. If I start my prog it uses 15 MB.
1. When I use my program with all functions it needs 50 MB. I think that is to much for small program.
2. When I minimize the program in the task bar (Windows) and maximize it again, it takes only 6 MB RAM. It shrinks from 50 MB to 6 MB. How is this possible?
Thanks !
Bye
 
Thomas Smets
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is IMHO many reason for it !
The most likely one is that you do not de-allocate the Objects as it should.
Basically you should nullify all the references you have when you don't need them !

All your class can then implement the interface like this :

You basically don't need to call on
System.gc();, it will be OKAY w/o that !
By doing that you basically reduce the length of chains of unreferenced objects making the job of the GC easier !
There is on IBM alpha work a very good article about that !
You may also reduce the amount of memeory a program is allowed to use with the java -X options ...
Yrs,
[ April 20, 2002: Message edited by: Thomas SMETS ]
 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!!!
Do mean the Interface "Destroyable"? I will try it, thanks a lot!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!