analyze static method

Future<LeakedInfo?> analyze(
  1. RawLeakNode node
)

The type of GC root which is holding a reference to the specified object. Possible values include: * class table * local handle * persistent handle * stack * user global * weak persistent handle * unknown

run on subIsolate

Implementation

static Future<LeakedInfo?> analyze(RawLeakNode node) async {
  _analyzer ??= LeakAnalyzer();
  final leakedInstance = node.leakedInstance;
  final maxRetainingPath = node.maxRetainingPath;
  if (leakedInstance?.id != null) {
    final retainingPath = await _analyzer!
        ._getRetainingPath(leakedInstance!.id!, maxRetainingPath);
    if (retainingPath?.elements != null &&
        retainingPath!.elements!.isNotEmpty) {
      final retainingObjectList = retainingPath.elements!;
      final stream = Stream.fromIterable(retainingObjectList)
          .asyncMap(_analyzeObject2Node);
      List<RetainingNode> retainingPathList = [];
      for (var element in (await stream.toList())) {
        if (element != null) {
          retainingPathList.add(element);
        }
      }
      return LeakedInfo(retainingPathList, retainingPath.gcRootType);
    }
  }
  return null;
}