Java automatically calls garbage collector, then why we need manual calls for garbage collection? When should use System.gc()
Garbage collection process is not under the user's control.So it makes no sense to call System.gc(); explicitly. It entirely depends on the JVM.
Few days back, I had asked exactly the same question : [Here].
In fact, many questions related to calling System.gc(); explicitly have been already asked and answered here. Calling System.gc(); explicitly is always considered as poor programming skill, although it won't do any harm.
Here are the few links that I you should go through it. It will definitely clarify your doubt.
PS : Btw, you should seriously take the extra effort to go through similar StackOverflow questions before posting about your doubts.