• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Runtime Interface - Garbage Collection

 
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Do Re Mi Fa So La Tiny Ad
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic