Hi,
I am using a Java application which pumps a number of messages. When messages are published the threads and memory increases. According to the architecture of the application the memory should come down after the processing of messages is over. The threads do come back to normal count, but the memory remained high. For this, I explicitly made a call to the Garbage Collector after the processing of messages was over. Is calling Garbage Collector a standard practise in Java in such situation? If no, please suggest an alternative way to do this.
Thanks,
Usha
-
calling Garbage Collector (2 messages)
- Posted by: Usha Kiran
- Posted on: December 25 2005 23:09 EST
Threaded Messages (2)
- calling Garbage Collector by c b on December 27 2005 16:34 EST
- calling Garbage Collector by Eric Bowman on December 28 2005 04:50 EST
-
calling Garbage Collector[ Go to top ]
- Posted by: c b
- Posted on: December 27 2005 16:34 EST
- in response to Usha Kiran
make sure you're running w/ a -server flag on your java command line to run in server mode. make sure you're not leaking references, this would cause the jvm memory heap to balloon.
hope that helps,
www.binaryfrost.comHi,I am using a Java application which pumps a number of messages. When messages are published the threads and memory increases. According to the architecture of the application the memory should come down after the processing of messages is over. The threads do come back to normal count, but the memory remained high. For this, I explicitly made a call to the Garbage Collector after the processing of messages was over. Is calling Garbage Collector a standard practise in Java in such situation? If no, please suggest an alternative way to do this.Thanks,Usha
-
calling Garbage Collector[ Go to top ]
- Posted by: Eric Bowman
- Posted on: December 28 2005 04:50 EST
- in response to Usha Kiran
No, calling the GC is not "standard practise".
I have been known to invoke the GC while looking at a performance monitor, just to see if it looks like we are leaking (or just using more) memory. But never programmatically, and never in production.
If you are calling it in your application code, it's almost certainly a bad thing, particularly if you are using a modern JVM.