Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

dispose() does not release objects  RSS feed

 
Venkatesh Rajendran
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have one swing application which has some screen whenever I click close or cancel the screens i am dispossing the object.
In this situation if i look on the task manager CPU memory size is getting increase whenever open new screen but it does not get decreased when i close a screen.
This cause if i opened 20 screens 30 MB of memory in use but currently i am using only one screen hence my system gets slow.
If any one know alternative way to release the object after saying dispose().
Thanks in advance
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Venkatesh,
The mechanism by which the java virtual machine (JVM) releases memory, is know as "garbage collection".
According to the Java Virtual Machine Specification, a JVM does not need to implement garbage collection.
Since I saw no mention -- in your post -- of which JVM you are using, I cannot say whether it implements garbage collection or not.
I know that SUN's JVM (version 1.3.1) _does_ implement garbage collection. However, as far as I know, you have no control over when garbage collection will occur. I'm quite sure it will not occur immediately after you "dispose" of your "screen". For SUN's JVM, the "java" command has the "verbose:gc" option:
http://java.sun.com/j2se/1.3/docs/tooldocs/win32/java.html
[I am assuming you are on Windows -- since I didn't see any mention of your platform in your post.]
There are many articles available on the Internet regarding the garbage collection mechanism of the JVM. You may find some relevant articles at these Web sites (assuming you haven't already found them):
http://www.javaworld.com
http://developer.java.sun.com
http://www-106.ibm.com/developerworks/java/
Hope this has helped you.
Good Luck,
Avi.
 
Venkatesh Rajendran
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Avi,
Thanks for your useful information and reply. I am having J2SDK 1.4.1 and Windows 2000.
I will have look in to the links provided by you.
Thanks & Regards,
Venkat
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!