To find out what is going on the heap in terms of objects and classes, turn to the memory monitor. It gives you continuous updates and lets you set marks to observe changes over time. To see references, allocations and object data, you take a snapshot by clicking on the camera in JProfiler's toolbar. |
|
 |
|
| While some profilers do display the heap as a tree, this only tells you a fraction of the story. In reality, the heap is a highly entangled graph of object references - just like the world wide web. This is why JProfiler's heap walker works like a browser: it displays a current set of objects that can be changed by following the hyperlinks on the left side of the view. |
|
| After taking a snapshot of the heap, the heap walker overview page lets you choose your starting point for browsing. The overview page explains the different views which can be chosen for the current object set and gives instructions for a problem solving strategy. Often, you would want to choose the classes view, select a specific class there and then look for its allocations. Alternatively you start out with the allocation, look where all the objects come from and then see what classes are involved in the selected allocation spot. |
|
 |
|
| The most important views for finding memory leaks, however, are the reference views. Here, you see all incoming or outgoing references with respect to the current object set. |
|
 |
|
Sometimes you may wonder: where do all these Strings come from? On the left you see a frequent answer: Most of them are held in hash tables. From here on you can continue to explore. An especially convenient feature is auto-browsing. By double-clicking on any item of interest, a filter is set automatically and the most probable view is brought up. |
|
| Not only is the heap walker your first stop for finding memory leaks, it also makes for an excellent debugging facility as you can inspect instances, arrays and classes in the current object set and navigate along references.There are many situations where the usual debugging approach will fail and JProfiler will help you find out. |
|
 |