Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Force Garbage Collection

966 views
Skip to first unread message

svana...@jny.com

unread,
Jul 11, 2008, 12:05:29 PM7/11/08
to
Anybody can help me, how to force garbage collection manually on the websphere application server V5.0 admin console, whenever JVM reaches certain limit say 512 MB. My current miimum JVM heap size settings is 256 MB and maximum heap size is 1 GB.

Appreciate your response.

Thank you.

Vasu

Ben_

unread,
Jul 11, 2008, 12:51:12 PM7/11/08
to
> how to force garbage collection manually

Why ?

Rule of thumb is you don't want to tell GC when to run.

Brian S Paskin

unread,
Jul 13, 2008, 1:46:18 AM7/13/08
to
Hi, there is no way to force a GC through the Admin Console. It sounds like you have a memory leak in your application. You can use the wsadmin.sh command to force a thread and heap dump.

By the way, WebSphere v5.0 is no longer supported by IBM.

Regards,

Brian

Sven Vermeulen

unread,
Jul 22, 2008, 2:21:01 PM7/22/08
to
On Fri, 11 Jul 2008 12:05:29 -0400, svanaparthi wrote:

> Anybody can help me, how to force garbage collection manually on the
> websphere application server V5.0 admin console, whenever JVM reaches
> certain limit say 512 MB. My current miimum JVM heap size settings is
> 256 MB and maximum heap size is 1 GB.

You can't, but you can ;-)

If your application has a web archive, create a JSP page with "System.gc
();" inside it (as java code). Once you go to the JSP page, it'll invoke
a System gc (unless the application server is running with -XX:
+DisableExplicitGC or equivalent).

However, forcing a GC is bad practice. It performs a "Full GC", which
freezes the application for a (short) while.

Also, GCs don't resolve memory leaks - they only collect unreferenced
objects. As a rule, it is best to tune your JVM and have it perform its
GCs when it deems it necessary.

Wkr,
Sven Vermeulen

Amol Kolhe

unread,
Jul 23, 2008, 7:07:15 AM7/23/08
to
On Jul 22, 2:21 pm, Sven Vermeulen <firstname.lastn...@siphos.be>
wrote:

Excellent tip, I am going to try this with a servlet.
Thanks a lot.

0 new messages