The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 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.


About the garbage collector

Posted by Chet Underwood, Esq. on November 26, 2001 at 3:01 PM

I think this is probably dependent upon the particular implementation of the JVM. The JVM implementor can probably choose to keep that memory in a pool in the JVM, or free it to the OS.

It would be easy to write a little test program to see how your particular JVM works: Have it allocate as much as possible, then dereference everything (but keep running, so as not to unload the JVM). Then check and see if the OS is out of memory and stays that way until the JVM is shut down.

On the other hand, you can have "memory leaks" in Java by having unused references to objects hanging around, but you've probably checked for that.

- Chet

> When java does the garbage collection, is the memory returned back to the OS or not? I have a collection of servlets running on Jserv+Apache on Redhat Linux 6.2 using IBM Java.

> What I have seen is that usage of memory keeps on creeping up. I have checked for memory leaks (properly closing the database connections etc.).

> I have no clue as to what is going wrong. Please help.


Sponsored Links

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