Jump to Content
  Previous Next
Content starts here

Detection Process Used with Memory Leak Detector

Ok, now you have spotted that you have a memory leak. It is now time to start using the Memory Leak Detector to drill down to the cause of the leak. Figure 2-3 gives an overview of the different steps that you need to take to get to your memory leak.

Figure 2-3 Memory Leak Detection Process

Memory Leak Detection Process

  1. Trend Analysis-What Data is Leaking?
  2. Object Type Relations Study
  3. Instance Investigation

Trend Analysis-What Data is Leaking?

Trend analysis means to observe continuously updated object type related information and try to discover object types with suspicious memory growth. These object types should then be studied in the next phase of the memory leak detection process. The information in the trend analysis table is updated every ten seconds or more often if there are very frequent garbage collections.

Note: The trend analysis is a great way to find even the smallest leaks, before they even throw OutOfMemory exeptions.

Object Type Relations Study

Studying object type relations means following reference paths between object types. The goal is to find interesting connections between growing object types and what types of objects point to them. Finding the object type guilty of unusual memory growth will lead to the third and final phase of the memory leak detection process.

Instance Investigation

Instance investigation consists of finding an instance of abnormal memory size or an abnormal amount of references being held and then inspecting that instance. When inspecting an instance, values will be displayed; e.g. field names, field types, and field values. These values will hopefully lead you to the correct place for the error in the application code; i.e. where that particular instance of that particular object type is allocated, modified, or removed from the collection, depending upon what the situation implies. Minimizing the problem areas of the ones connected to the suspected instance will most likely lead you on the right track to finding the actual problem causing the memory leak and you will be able to fix it.

  Previous Next