JRockit Memory Leak Detector User Guide

     Previous  Next    Open TOC in new window  Open Index in new window  View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Getting Started with Memory Leak Detection

This section describes the BEA JRockit Memory Leak Detector (from now on referred to as Memory Leak Detector) start-up procedure and the user interface. Information on the following topics are included:

 


Overview of the Memory Leak Detection Process

The memory leak detection process consists of three phases:

  1. Trend analysis
  2. Object type relations study
  3. Instance investigation

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.

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 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.

 


Starting the Memory Leak Detector

Before you start the Memory Leak Detector and your application, you need to start the management server.

  1. Start your Java application with the BEA JRockit JVM as usual, but add the -Xmanagement option to the command line.
  2. Start the Memory Leak Detector by typing memleak in a command window.
    The Connect to JRockit window appears.
  3. Enter a name for the server in Server name. This is the name (or IP address) of the computer that runs JRockit and the application that you want to monitor.
  4. Enter a port number in Port.
  5. For information on ports, see the User Guides for the Management Console:
    http://edocs.bea.com/jrockit/tools/usingjmc/start.html#1035010 (for JRockit 5.0)
    http://edocs.bea.com/jrockit/tools/usingjmc142/mancons.html#1001904 (for JRockit 1.4.2)

  6. Click Connect.
  7. The Memory Leak Detector window opens (see Figure 2-1).

JMX Authentication

There are two system properties that can be set to enable authentication:

To enable the authentication, you need to set these properties when launching the Memory Leak Detector by typing, for example:

java -Dmemleak.jmx.username=<username> -Dmemleak.jmx.username=<password> -jar <path to MemoryLeakDetector.jar>

If you are using the memleak launcher in the \bin catalog, the command can, for example, look like this:

-J-Dmemleak.jmx.username=<password>

 


Touring the Memory Leak Detector Interface

When it is not connected to any BEA JRockit JVM, the Memory Leak Detector window looks like Figure 2-1. The interface consists of four tabs, a tool bar, main menus, and a status bar.

Figure 2-1 The Main Window of the Memory Leak Detector

The Main Window of the Memory Leak Detector

Tabs Explained

The main window of the Memory Leak Detector contains four tabs as shown in Figure 2-2. Table 2-1 explains what you can do under the different tabs.

Figure 2-2 The Tabs in the Memory Leak Detector (Indicates Work Flow)

The Tabs in the Memory Leak Detector (Indicates Work Flow)

Table 2-1 Memory Leak Detector Tabs Explained
Tab
Description

The Status bar in the Memory Leak Detector

From the Trend tab you view a trend analysis of the object types on the Java heap. You will see a list of all types that occupy more than 0.1% of the heap (this number can be changed in File > Preferences > Trend). The object type with the highest growth rate will be listed first.

The Status bar in the Memory Leak Detector

From the Types tab you view a type graph that shows how different types point to each other.

The Status bar in the Memory Leak Detector

From the Instances tab you view an instance graph that shows how different instances point to each other.

The Status bar in the Memory Leak Detector

From the Allocation Stack Traces tab you view where a certain type is allocated in the code.

Toolbar Explained

The Memory Leak Detector tool bar, see Figure 2-3, contains, for example, buttons to connect to the JRockit instance. See Table 2-2 for an explanation of the different tools in the tool bar.

Figure 2-3 The Toolbar in the Memory Leak Detector

The Toolbar in the Memory Leak Detector

Table 2-2 Toolbar Icons Explained
Icon
Description

The Status bar in the Memory Leak Detector

Connect to the management server. This button connects you to the management server, which in turn allows you to monitor your Java application.

The Status bar in the Memory Leak Detector

Disconnect from the management server and your Java application.

The Status bar in the Memory Leak Detector

Start monitoring your Java application.

The Status bar in the Memory Leak Detector

Pause the screen updating.

The Status bar in the Memory Leak Detector

Stop the current monitoring.

The Status bar in the Memory Leak Detector

Refresh the current view.

The Status bar in the Memory Leak Detector

Zoom in on a type or an instance. This tool helps you navigate in the graph.

The Status bar in the Memory Leak Detector

Zoom out from a type or an instance.

The Status bar in the Memory Leak Detector

Center objects in your viewing area.

Status Bar Explained

The status bar (Figure 2-4) at the bottom of the window displays information regarding the current connection, whether the trend analysis is on or not, and whether the allocation stack trace is on or not.

Figure 2-4 The Status bar in the Memory Leak Detector

The Status bar in the Memory Leak Detector


  Back to Top       Previous  Next