java - When does System.gc() do anything -
i know garbage collection automated in java. understood if write system.gc()
in code java vm may or may not decide @ runtime garbage collection @ point. how work precisely? on basis/parameters vm decide (or not do) gc when sees system.gc()
? there maybe examples in case is thought set in code?
in practice, usually decides garbage collection. reply varies depending on lots of factors, jvm you're running on, mode it's in, , garbage collection algorithm it's using.
i wouldn't depend on in code. if jvm throw outofmemoryerror, calling system.gc() won't stop it, because garbage collector effort free much can before goes extreme. time i've seen used in practice in ides it's attached button user can click, there it's not terribly useful.
java garbage-collection
No comments:
Post a Comment