Garbage Collection is not about destroying Objects.
Its all about managing memmory.The reason for the existence of the garbage collector is to recover memory that your program is no longer using.
You cannot force garbage collection to take place.
However calling Sysem.gc() is a "hint" to the runtime engine that , now might be a good time to run the GC. Some implementations take that hint to heart and some don't.
No comments:
Post a Comment