Memory Leak is a situation where there are objects present in the heap that is no longer used, but the garbage collector is unable to remove them from memory, and therefore, they’re unnecessarily maintained. A memory leak is bad because it blocks memory resources and degrades system performance over time.
Using Java profiling you can monitor different JVM parameters, including object creation, thread execution, method execution, and yes, garbage collection. also, Using tools that can detect memory leaks. Using heap dumps can also help.