Discussions

EJB design: calling Garbage Collector

  1. calling Garbage Collector (2 messages)

    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

    Threaded Messages (2)

  2. calling Garbage Collector[ Go to top ]

    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.com
    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
  3. calling Garbage Collector[ Go to top ]

    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.