aspose file tools*
The moose likes Beginning Java and the fly likes Regarding Garbage Collection!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Regarding Garbage Collection!!" Watch "Regarding Garbage Collection!!" New topic
Author

Regarding Garbage Collection!!

Ravi Kumar Ravuru
Ranch Hand

Joined: Apr 18, 2002
Posts: 176
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

Joined: Sep 18, 2003
Posts: 17
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.


Wish U Happiness,<br />Sanjeev.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34

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."


[Jess in Action][AskingGoodQuestions]
 
 
subject: Regarding Garbage Collection!!