I know lots of question have been asked about Garbage Collection and I have gone through them, but I still have have some doubts.
If we cannot force the JVM fo
1) The often repeated statement is true and yet misleading. The specification of the method (i.e. the javadocs) are phrased in a way that make a noop implementation valid. In other words, there are no spec-guarantees that it does anything or only do something asynchronously or whatever.
But implementations can provide much stronger behavior. In other words, what people should be saying is that System.gc
is implementation- and configuration-dependent and under some circumstances does consistently trigger a GC on every call.
2) Perm gen is an implementation detail of the hotspot JVM prior to java 8.
3) They aren't
4) "Application" is too fuzzy, you could run multiple applications on a shared JVM. There is one managed heap per JVM.
5) Those are two separate questions.
6) Depends on the JVM implementation and the chosen GC algorithm. I suggest you read the documentation.