Locating Possible Transient Object Leaks

The Schema menu in the Schema Browser enables you to scan all methods in a schema or class for possible transient leaks.

The transient leak analysis can report potential leaks that are not in fact leaks, for reasons that are outside of the understanding of the analysis. You can mark such entries for exclusion from the report that is produced, by placing the following tag in a comment on the same line.

[ExcludeFromTransientLeakReport]

The following code fragment examples mark lines of code for exclusion from the transient leak analysis.

create cust transient;   // create the customer [ExcludeFromTransientLeakReport]
cust := methodReturnsTransient();   // [ExcludeFromTransientLeakReport]

In addition, JADE provides a PossibleTransientLeaks global constant category that contains the ExcludeFromTransientLeakReport global constant.

To locate possible transient object leaks in the schema selected in the Schema Browser

  1. Select the Find Possible Transient Leaks command from the Schema menu.

    The Find Possible Transient Create Leaks dialog, shown in the following image, is then displayed.

    The name of the schema selected in the Schema Browser is displayed in the first combo box in the Search Criteria group box.

  2. If you do not want to search for possible transient leaks involving local variables and parameters in all methods in the schema selected in the Schema Browser (the default value), perform one of the following actions in the Search Criteria group box.

  3. Uncheck the Report created objects not deleted check box if you do not want to locate any transient create statement leaks on local variables or method parameters where there is no delete of that variable and that variable was not returned by the method and was not passed as a parameter to another method.

    By default, this check box is checked, indicating that created objects are checked for deletion.

  4. Uncheck the Report created in loop but not deleted in loop check box if you do not want to locate possible leaks where a create is performed inside a loop but the delete is outside of the loop. This may not actually be a leak, because only one create may have been performed.

    By default, this check box is checked, indicating that objects created in a loop are checked for deletion within that loop.

  5. Check the Report objects not deleted but assigned check box if you want to locate creates performed where there is no delete, but the variable was assigned to another property or variable. This may not represent a leak, as it is not known whether this value is subsequently deleted.

    By default, this check box is unchecked, indicating that assigned objects are not checked for deletion.

  6. Check the Report objects not deleted but passed to other methods check box if you want to locate creates performed where there is no delete, but the variable was passed as a parameter to another method. This may not represent a leak, as it is not known what subsequently happens to that object.

    By default, this check box is unchecked, indicating that objects passed to other methods are not checked for deletion.

  7. Check the Report created objects returned from method check box if you want to locate creates performed where the object is returned from the method. This may not represent a leak, as it is not known what the calling method will do with that object.

    By default, this check box is unchecked, indicating that objects returned from methods are not scanned for possible leaks.

  8. Check the Report deletion not performed in epilog check box if you want to locate objects that have been created and deleted but where the object is not deleted in the epilog section of the method. This situation would result in a leak if an exception occurred during the method call.

    By default, this check box is unchecked, indicating that epilogs are not scanned for possible leaks.

  9. Check the Ignore [ExcludeFromTransientLeakReport] tags check box if you want method lines containing this tag in a comment to be analyzed for possible transient leaks instead of being ignored.

    By default, this check box is unchecked, indicating that method lines that contain the [ExcludeFromTransientLeakReport] tag are ignored during the possible transient leak analysis.

  10. In the Output Options group box, select the Print Preview option button if you want to preview the possible transient leaks report output.

    By default, the Methods List Browser option button is selected, indicating that the methods in which there are possible transient leaks are displayed in a Methods Browser, shown in the following image, so that you can edit the method source whose transient leak list entry you have selected.

  11. Click the Search button to initiate the search. Alternatively, click the Cancel button to abandon your selections.

The following image is an example of the possible transient leaks displayed in a Methods Browser.

When you press Tab to move focus from the table of methods at the top of the browser to the editor pane, the cursor is positioned at the left of the source line in which the possible transient leak has been identified.

The result of your search is output to a report that is displayed in a Methods Browser or in print preview mode, depending on the option that you selected in step 10 of the previous instruction. This report contains the:

The report will also track calls to RootSchema methods that create and return a transient object that needs to be deleted (for example, Class::allProperties) and methods scanned that return a transient object that was created. If a possible leak is detected for such situations, the description will include the method name involved and the line number will be the statement in which the call was made.