True or false: Low memory situations cause GC to run? I read somewhere that GC only runs after the heap has been exhausted, and that when it runs, all other threads are suspended. I've somewhat confirmed this particular behavior in Sun reference implementation JVM's. Is this behavior specified by Java or JVM dependent? Anyhow, the answer to my first question would seem to be true, but I am not sure. A related question would be 'does a heap allocation failure force gc to run'? Again I think the answer id yes, just from observing Sun's jvm.
The answer is false. Though it is a nice to have feature, garbage collection is not guaranteed and hence your program can run out of memory!! Remember that GC is vendor specific and may not depend on howmuch memory is left on the heap Ajith
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
i fully agree with Ajith. U can never force GC, and u can never know when it is activated, so there can b possibility of program going out of memory. So a heap allocation failure can never force gc to run.
Just the other day, I was thinking ... about this tiny ad: