Forums Register Login

Runtime Interface - Garbage Collection

+Pie Number of slices to send: Send
Hi,

Just wanted to know how can we control the Garbage Collection behaviour throught the Runtime Interface.

Thanks,
Rahul Juneja
+Pie Number of slices to send: Send
You can't control it, all you can do is assign objects to null value which gets them ready for garbage collection.

You can then call Runtime.gc(); but this may not execute immediately as it is only a request.

more info see.http://www.javaworld.com/javaworld/jw-08-1996/jw-08-gc.html
+Pie Number of slices to send: Send
Pally,

Is there any ways through which we can optimise the performance of Garbage Collection as I have heard there are certain parameters which helps in setting heap size in JVM or something Simmillar.

Thanks,
Rahul Juneja
+Pie Number of slices to send: Send
Hi,
It depends upon the size of your application. For big application where there are many threads running you need to do gc optimization. For most of the application using the default garbage collector will be ok.

Try giving memory to your virtual machine. you can set -Xms and -Xmx.

According to the number of processors increase the memory .

cheers
Whose rules are you playing by? This tiny ad doesn't respect those rules:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 747 times.
Similar Threads
Garbage Collection Problem
gc
Garbage Collection
Tech Word Game
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 07:28:25.