allProcessTransientInstances

allProcessTransientInstances(objArray:          ObjectArray;
                             maxInsts:          Integer;
                             includeSubclasses: Boolean);

The allProcessTransientInstances method of the Class class adds all transient instances of the receiver class (and optionally the subclasses of the receiver class) that were created by the current process to the array specified in the objArray parameter. (Note that the object array is not cleared before instances are added.)

The maxInsts parameter specifies the maximum number of transient instances. A maxInsts parameter value of zero (0) indicates that there is no maximum number of transient instances.

All transient instances of the subclasses of the receiver class are included in the array when the includeSubclasses parameter is set to true.

The code fragment in the following example shows the use of the allProcessTransientInstances method.

create coll transient;
foreach class in classColl do
    class.allProcessTransientInstances(coll, 0, false);
    foreach object in coll do
        if not (object = self or object = caller) then
            count.bump;
            found := true;
            if count = 1 then
                write 'Class - ' & class.name;
            endif;
            write '  Transient - ' & object.String;
        endif;
    endforeach;
    coll.clear;
    count := 0;
endforeach;

See also "Caveat When Handling Shared Transient Class Instances", earlier in this section.