FgenerateHeapSnapshot
Bun

function

generateHeapSnapshot

format?: 'jsc'

Show precise statistics about memory usage of your application

Generate a heap snapshot in JavaScriptCore's format that can be viewed with bun --inspect or Safari's Web Inspector

format: 'v8'
): string;

Show precise statistics about memory usage of your application

Generate a V8 Heap Snapshot that can be used with Chrome DevTools & Visual Studio Code

This is a JSON string that can be saved to a file.

const snapshot = Bun.generateHeapSnapshot("v8");
await Bun.write("heap.heapsnapshot", snapshot);

Referenced types

interface HeapSnapshot

JavaScriptCore engine's internal heap snapshot

I don't know how to make this something Chrome or Safari can read.

If you have any ideas, please file an issue https://github.com/oven-sh/bun