Java Reference
In-Depth Information
But remember, there is no guarantee that any object actually awaiting
finalization is using some of that resource, so runFinalization may be of
no help.
The fullGC method is too aggressive for most purposes. In the unusual
circumstance that you need to force garbage collection, a single invoc-
ation of the System.gc method will gather most if not all of the avail-
able garbage. Repeated invocations are progressively less productiveon
many systems they will be completely unproductive.
Exercise 17.1 : Write a program to examine the amount of memory
available on start up and after allocation of a number of objects. Try
invoking the garbage collector explicitly to see how the amount of free
memory changesmake sure you don't hold references to the newly al-
located objects of course.
 
Search WWH ::




Custom Search