How often should garbage collection be called? System.gc ()? I mean after what action?
1 answer
System.gc () - does not call the garbage collector, but simply recommends the system to perform the build.
Moreover, the behavior of the garbage collector depends heavily on the strategies
My answer to the question: "how often?" - do not touch this method. Remember about it after you learn well how the virtual machine and the garbage collector work, not before. At this stage, you will not be able to benefit from this knowledge.
I recommend instead to deal with the causes that lead to leaks.
- 2Ok, thanks, I will check my classes for leaks - Denis Kotlyarov
|
System.gc()basically does not guarantee anything. - Vartlok