This week's book giveaway is in the Design and Architecture forum.
We're giving away four copies of Communication Patterns: A Guide for Developers and Architects and have Jacqui Read on-line!
See this thread for details.
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

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
 
Proudly marching to the beat of a different kettle of fish... while reading this tiny ad
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic