Esempio n. 1
0
    public final String suffix(Object row) {
      Node node = (Node) row;
      if (node.gcRoots == null) {
        try {
          GCRootInfo[] gc = snapshot.getGCRootInfo(node.objectId);
          node.gcRoots = gc != null ? GCRootInfo.getTypeSetAsString(gc) : Node.NOT_A_GC_ROOT;
        } catch (SnapshotException e) {
          throw new RuntimeException(e);
        }
      }

      return node.gcRoots == Node.NOT_A_GC_ROOT ? null : node.gcRoots;
    }
Esempio n. 2
0
 private void outputGeneralObjectInfo(IObject object, String identation) throws SnapshotException {
   String clazzName = object.getClazz().getName();
   String gcRootInfo = "";
   if (snapshot.isGCRoot(object.getObjectId())) {
     gcRootInfo =
         GCRootInfo.getTypeSetAsString(snapshot.getGCRootInfo(object.getObjectId())) + " ";
   }
   if (snapshot.isClass(object.getObjectId())) {
     clazzName = "[Class] " + ((IClass) object).getName();
   }
   String objAddr = Long.toString(object.getObjectAddress(), 16);
   out.println(
       String.format(
           "%s<class><![CDATA[%s @ 0x%s]]></class>", identation, gcRootInfo + clazzName, objAddr));
   out.println(String.format("%s<id>0x%s</id>", identation.toString(), objAddr));
 }