IBM Tivoli Composite Application Manager for Application Diagnostics, Version 7.1.0.1

Customize Memory Leak Diagnosis - J2EE Agent

To enable Memory Leak Diagnosis with customized settings:

  1. Make a copy of the DC_home/itcamdc/etc/memory_leak_diagnosis.xml file, and open it up in a text editor.

  2. Modify the parameters in the memory_leak_diagnosis.xml file. The following is a description of the parameters you can modify:


    Parameters for Memory Leak Diagnosis Configuration File

    Tag Name Description
    heapAllocationTarget Defines the allocating and allocated classes for which heap allocations will be Byte-Code-Instrumented. By default, all allocating and allocated classes are selected. By modifying the allocatingClassName and allocatedClassName tags within the heapAllocationTarget tag, you can implement a more granular selection. Each heapAllocationTarget tag must contain exactly one allocatingClassName tag, and one or more allocatedClassName tags. Multiple heapAllocationTarget tags can be specified.
    allocatingClassName Name of a class or classes to be modified. Each heapAllocationTarget tag must contain exactly one allocatingClassName tag.
    allocatedClassName Identifies the specific heap allocation requests within the class or classes identified by the allocatingClassName tag that are to be Byte-Code-Instrumented. Each heapAllocationTarget tag must contain one or more allocatedClassName tags.

    Both the allocatingClassName and the allocatedClassName tags can include wildcard characters. The following summary describes how the wildcard characters work:

    • Asterisk (*) stands for zero or more occurrences of any character when used by itself. When embedded within a sequence of characters (for example, java.*.String), it matches zero or more occurrences of any character except the package separator (.).

    • Two periods (..) can be used to specify all sub-packages (for example, java..String matches java.lang.String). It matches any sequence of characters that starts and ends with the package separator (.).

    • If the allocated class name begins with an exclamation point (!), any heap allocations for classes that match the allocated class name are specifically excluded from BCI for Memory Leak Diagnosis. This is useful for indicating that all heap allocations within a class or group of classes are to be Byte-Code-Instrumented except for those allocations that are specifically excluded.

    For example, an application with a package name of com.mycompany.myapp has the following requirements:

    • Within the Customer class, all heap allocations should be Byte-Code-Instrumented.

    • Within the Supplier class, all heap allocations should be Byte-Code-Instrumented except for allocations for classes beginning with java.lang.String.

    The following example describes the contents of the customized memory_leak_diagnosis.xml file that accomplishes this:

      <aspect>
          <type>application</type>
          <name>com.ibm.tivoli.itcam.toolkit.ai.aspectj.apptrace.CaptureHeap</name>
          <enabledProperty>
                      com.ibm.tivoli.itcam.toolkit.ai.enablememoryleakdiagnosis</enabledProperty>
          <defaultEnabled>true</defaultEnabled>
          <-- Modify the heapAllocationTarget tag to select or deselect the allocating and             allocated classes for Memory Leak Diagnosis -->
          <heapAllocationTarget>
              <allocatingClassName>
                         com.mycompany.myapp.Customer</allocatingClassName>
              <allocatedClassName>*</allocatedClassName>
          </heapAllocationTarget>
          <heapAllocationTarget>
              <allocatingClassName>
                         com.mycompany.myapp.Supplier</allocatingClassName>
              <allocatedClassName>!java.lang.String*</allocatedClassName>
          </heapAllocationTarget>
      </aspect>

  3. Complete one of the following steps:

    • Save the file in custom_directory, then complete the following steps:

      1. In the custom_directory/toolkit_custom.properties file, uncomment the following line by removing the number sign (#) at the beginning of the line:
        am.camtoolkit.gpe.customxml.leak=DC_home/itcamdc/etc/
        memory_leak_diagnosis.xml

      2. Change this line by replacing the path with just the file name of the file you modified in Step 2.

      3. Set the following property to true:
        com.ibm.tivoli.itcam.toolkit.ai.enablememoryleakdiagnosis=true

    • Save the file in any directory on your server, then complete the following steps:

      1. In the custom_directory/toolkit_custom.properties file, uncomment the following line by removing the number sign (#) at the beginning of the line:
        am.camtoolkit.gpe.customxml.leak=DC_home/itcamdc/etc/
        memory_leak_diagnosis.xml

      2. Change this line by specifying the path and name for the file you modified in Step 2.

      3. Set the following property to true:
        com.ibm.tivoli.itcam.toolkit.ai.enablememoryleakdiagnosis=true


Parent topic:

Control Instrumentation of Application Classes for Memory Leak, Lock and L3 Method Analysis