IBM Tivoli Composite Application Manager for Application Diagnostics, Version 7.1.0.1

Customize memory leak diagnosis

By default, if memory leak analysis is enabled, all application classes are Byte-Code-Instrumented for memory leak analysis and all information is collected in MOD L3. You may configure the data collector to exclude some classes from BCI for memory leak analysis.

To set classes for Memory Leak Diagnosis:

  1. Make a copy of the DC_home/itcamdc/etc/memory_leak_diagnosis.xml file in a temporary location. Open the copy in a text editor.

  2. Modify the parameters in the file. The following table describes the tags you can modify:


    Parameters for the 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 allocatingClassName and allocatedClassName tags can include wildcard characters. The following is a summary of 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. It matches any sequence of characters that starts and ends with the package separator (.).

      For example, java..String matches java.lang.String and com.ibm..* matches any declaration beginning with com.ibm.

    • 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 shows 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 the DC_home/runtime/app_server_version.node_name.server_name/custom directory, then complete the following steps:

      1. In the toolkit custom properties file set the property am.camtoolkit.gpe.customxml.leak to the name (without path) of the file you modified in Step 2.

      2. In the same toolkit custom properties file, set the following property to true:

          com.ibm.tivoli.itcam.toolkit.ai.enablememoryleakdiagnosis=true

    • Save the file in any directory on the monitored host, then complete the following steps:

      1. In the toolkit custom properties file set the property am.camtoolkit.gpe.customxml.leak to the path and name for the file you modified in Step 2.

      2. In the same toolkit custom properties file, sets the following property to true:

          com.ibm.tivoli.itcam.toolkit.ai.enablememoryleakdiagnosis=true


Parent topic:

Lock analysis, memory leak analysis, and method profiling and tracing

+

Search Tips   |   Advanced Search