Thread: Detect Memory Leak

Forum : New To Java   10 Jan, 2019 20:19
User Image


Joined: 11 Oct, 2018

Points: 100

Threads: 3

Posts: 7

Detect Memory Leak

| Quote Date : 10 Jan, 2019    Views:226    

How will we detect memory leak in our application?


User Image


Joined : 20 Apr, 2017

Points : 145

Threads: 9

Posts: 61

Re: Detect Memory Leak

Reply Date : 19 Feb, 2019

Detecting memory leaks:
      Memory leak is situation when there are objects present in the heap that are no longer used, but the garbage collector is unable to remove them from memory.
 There are types of memory leaks in java

 1.Memory leaks through static fields
2.Through unclosed resources
3.Improper overriding of equals() and hashcode() methods.
4.Inner classes that reference outer classes
5.Finalize() methods
6.Interned strings
7.Thread Locals
We can detect memory leaks by using
  JProfiler,YourKit,Java Visual VM, Net beans profiler
Enable garbage collection
Eclipse memory leak warnings

 Use reference object.?

Load More

No More Comments