What is memory leak?
freeing same memory multiple times will lead to memory leaks.
A memory leak is the repetitive allocation of memory without consequential release of it when no longer used. This will be leading to over consumption of memory.
accessing an object which is initialized with null, is called as memory leak.
all are true.
Memory leak is "wastage of memory" in simple terms.
If programmer keeps allocating memory by using "new" operator, and if there is no way to clean that memory then it leads to memory wastage. This is called as memory leak.
Note: Though java ensures garbage collection using GC, still there is a chance that java program may run out of memory (memory leak). This happens if static variables are linked with some object level elements. Object can't be cleaned as static variables are pointing to some elements of that object.
Back To Top