Does java have memory leaks?
Since Garbage collector will clean all the memory, there is no chance of having memory leaks in java
There is a chance of memory leaks in java also, if you tie up the object reference to a static variables and doing it indefinitely can cause memory leak.
Memory leak : Inability of Garbage collector to clean an object memory in the heap, due to some references to that object.
There is a chance of memory leaks in java also. If you tie up the object reference to a static variables then it can cause memory leak.
Reason for this is, static variables life time will be through out application life time. When there is a link between static variable pointing to an object, then that object can be cleaned only if static variable dies. But static variable dies only at application closing time. If these kind of references keep piling up in your application, then many objects will be lying in heap which GC can't clean.
Back To Top