Class MemorySnapshot

java.lang.Object
com.yourkit.api.MemorySnapshot

public final class MemorySnapshot extends Object
The class supports analysis of captured memory snapshots.
  • Constructor Details

    • MemorySnapshot

      public MemorySnapshot(@NotNull File snapshotFile) throws Exception
      Loads memory snapshot for analysis.
      Parameters:
      snapshotFile - the memory snapshot file to load; usually has extension .snapshot or .hprof
      Throws:
      Exception - if snapshot cannot be loaded for some reason
    • MemorySnapshot

      public MemorySnapshot(@NotNull File snapshotFile, @NotNull ObfuscatorType obfuscatorType, @Nullable File obfuscationLog) throws Exception
      Loads memory snapshot for analysis, automatically restoring obfuscated class, method and field names.
      Parameters:
      snapshotFile - memory snapshot file to be loaded
      obfuscatorType - obfuscator type; if profiled application was not obfuscated, specify ObfuscatorType.NONE or use constructor with one parameter MemorySnapshot(File) instead.
      obfuscationLog - obfuscation log file created obfuscating the profiled application; if obfuscatorType is ObfuscatorType.NONE, specify NULL.
      Throws:
      Exception - if snapshot cannot be loaded for some reason
  • Method Details

    • getObjectCount

      public int getObjectCount(String xmlSetDescription) throws Exception
      Calculates number of objects that correspond to the given description.
      Parameters:
      xmlSetDescription - the object set description; see Help for detail
      Returns:
      number of objects which match the description
      Throws:
      Exception - if the description is invalid
    • getShallowSize

      public long getShallowSize(String xmlSetDescription) throws Exception
      Calculates shallow size of objects that correspond to the given description.
      Parameters:
      xmlSetDescription - the object set description; see Help for detail
      Returns:
      shallow size of objects which match the description
      Throws:
      Exception - if the description is invalid