Why there is no guarentee for System.gc() method will perform garbage collection for a particular time?

Showing Answers 1 - 2 of 2 Answers

Neverquit

  • Nov 17th, 2005
 

Becuase it depends on the heapsize settings/memory aallocation for the objects to reside once the memory is full the gc is called.

Gaurav Modgil

  • Dec 9th, 2005
 

not necessarily does it wait for the memory to be fully allocated.

The garbage collection thread is looking at what percentage of available memory is already allocated..and if the memory allocation goes above a perticular level..say 80 %, the gc thread is invoced to claim back any unused memory, so that efficiency is not hompered when a memory request is made by an application thread.

Further if there is enough memory laying free...there is no need for the gc thread to look for memory...the same cycles can be used by some other thread.....efficiency considerations of the java design

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions