The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
July 2000

Advertisement

Advertisement

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.

Message:

memory management

Posted by saeed on January 13, 2002 at 12:43 AM

> Hi
> You don't have to do any memeory management in java. Whenever you want to allocate memory for any object use new keyword to do that. However, there is no corresponding delete keyword to release that memory on your own. Garbage Collector takes care of everything in java. When JVM runs low in memory it starts garbage collector which releases all unreferenced memory. However, if you want to run garbage collector on your own then you have to call one of the following method
> Runtime.getRuntime().gc () or System.gc()

> But note that garbage collector is a costly process and it may affect you program performance if you call gc() very often. So it is suggested to leave the task of memeory management on JVM.

> Thanx
> Kishori






Replies:

Sponsored Links



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