Promise<Object> (@NotNull PlaybackContext context) { if (!MemoryDumpHelper.memoryDumpAvailable()) { return Promises.rejectedPromise("Memory dump can't be collected"); } //noinspection CallToSystemGC System.gc(); String path = getMemoryDumpPath(); try { MemoryDumpHelper.captureMemoryDumpZipped(path); context.message("Memory snapshot is saved at " + path, getLine()); return Promises.resolvedPromise(); } catch (Exception e) { return Promises.rejectedPromise("Memory dump can't be collected"); } }