Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding Garbage Collection!!

 
Ravi Kumar Ravuru
Ranch Hand
Posts: 176
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Folks,
As everybody know that gc is low priority thread which will be running in JVM in order to track the memory(i mean release the memory for unreferrenced objects).Can we set the priority for gc?I mean highest priority for GC such that it will run for release of memory resources?
Regards,
Ravi
 
MSanjeevMehra
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am not sure weather we can set default gc thread´┐Żs priority or not. but u can use System.gc() for garbage collection or can create a thread with System.gc() statement and set priority of that thread.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Your basic assumption -- that "GC is a low-priority thread", and that changing the priority would "improve" GC in some way -- is flawed. No such thing is guaranteed or even true in general. The details of how GC works are implementation-specific and vary over time and across vendors.
Now, if you're interested in tuning the GC performance of HotSpot, there is a lot of material available. In particular, see this document. But it's not something you do by trying to fiddle with the priority of "the GC thread."
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic