pub fn heap_dump_json(
include_blocks: bool,
hash_addresses: bool,
) -> Option<String>Expand description
Live per-heap -> per-page -> (optional) per-block JSON snapshot of the current
subprocess (issue #269, Bun parity P4). Backs Bun’s shipped bun:jsc
heapStats({dump:true|"blocks"}).mimallocDump; see src/heap-dump.c for the JSON
shape ({"heaps":[{"seq":N,"pages":[{"id","block_size","used","reserved","thread_id"}], "blocks":[[id,size],...]}]}, blocks present only when include_blocks).
Set hash_addresses to mix every reported address through a per-process key so a
dump can be shared or diffed without exposing raw ASLR-derived pointers.
Safe, best-effort capture under concurrent frees (#374), using
HEAP_DUMP_JSON_DEFAULT_WAIT_MS as the owner-acquisition deadline. See
heap_dump_json_ex for the complete waiting and coverage contract.
Requires the diagnostics feature (#414): without it the dump is compiled out of the
C library and this returns None.
Otherwise returns None only on allocation failure (out of memory building the JSON
buffer), not for an empty subprocess.