aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-28 19:14:45 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-28 19:14:45 -0800
commit4efce63dadb596eeb08b7c72a0f8d1fdec54e1e1 (patch)
treea2b4ae282077389d5477ed6fac8af2e283f5a7e7
parent2a33bd2cc5e59294faf3dd442713a9ba0796eb45 (diff)
downloadbun-4efce63dadb596eeb08b7c72a0f8d1fdec54e1e1.tar.gz
bun-4efce63dadb596eeb08b7c72a0f8d1fdec54e1e1.tar.zst
bun-4efce63dadb596eeb08b7c72a0f8d1fdec54e1e1.zip
Update README.md
-rw-r--r--README.md10
1 files changed, 5 insertions, 5 deletions
diff --git a/README.md b/README.md
index ce83d4f01..7873653bc 100644
--- a/README.md
+++ b/README.md
@@ -4788,7 +4788,11 @@ Bun.gc(synchronously);
#### JavaScript heap snapshot
-You can also take a heap snapshot of the JavaScript heap. This is useful for debugging memory leaks.
+Heap snapshots let you inspect what objects are not being freed. You can use the `bun:jsc` module to take a heap snapshot and then view it with Safari or WebKit GTK developer tools.
+
+<img width="1324" alt="image" src="https://user-images.githubusercontent.com/709451/204429337-b0d8935f-3509-4071-b991-217794d1fb27.png">
+
+To generate a heap snapshot:
```ts
import { generateHeapSnapshot } from "bun:jsc";
@@ -4806,10 +4810,6 @@ To view the snapshot, open the `heap.json` file in Safari's Developer Tools (or
![image](https://user-images.githubusercontent.com/709451/204428943-ba999e8f-8984-4f23-97cb-b4e3e280363e.png)
-On success, it will look something like this:
-
-<img width="1324" alt="image" src="https://user-images.githubusercontent.com/709451/204429337-b0d8935f-3509-4071-b991-217794d1fb27.png">
-
#### Native heap stats
Bun uses mimalloc for the other heap. To report a summary of non-JavaScript memory usage, set the `MIMALLOC_SHOW_STATS=1` environment variable.