The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
January 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Cannot free memory explicitly in Java

Posted by Kishori Sharan on January 04, 2001 at 11:52 AM

When you use dispose ( ) method on frames then only system resources used by that Frame is released. The fremae itself is not destroyed , so all the member variables of that frame is still alive. The frame object will be destroyed only when it goes out of scope and Garbage Collector feels it should release the memory help up by that frame. Even if you run System.gc() it is just a hint to Garbage Collector to run . It is totally up to Gabage Collector when it realease the memory used by frame. So System.gc() won't help. And finally, you know there is no user's control in Java Program how and when the memory will be freed, so you cannot do it explicitly. Maximum, you can do is you can set that frame to null.



Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us