• Post Reply Bookmark Topic Watch Topic
  • New Topic

Runtime Interface - Garbage Collection  RSS feed

 
Rahul Juneja
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

Thanks,
Rahul Juneja
 
Pally Gharmount
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Rahul Juneja
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
sawan parihar
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!