Skip to content

Commit 18fa441

Browse files
Update debugging.md
1 parent 971b7d7 commit 18fa441

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/getting-started/debugging.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,19 @@ assume the availability of JavaScript to make debugging easier.
3636
## [wasm-memprof](https://github.com/kateinoigakukun/wasm-memprof)
3737

3838
If you are debugging memory leaks, [wasm-memprof](https://github.com/kateinoigakukun/wasm-memprof) can help you.
39-
It is a tool to profile memory usage of WebAssembly applications with minimal setup. Check the repository for more details.
39+
It is a tool to profile memory usage of WebAssembly applications with a few lines of setup code:
40+
41+
```javascript
42+
import { WMProf } from "wasm-memprof";
43+
import { SwiftDemangler } from "wasm-memprof/plugins/swift-demangler.js";
44+
45+
const swiftDemangler = SwiftDemangler.create();
46+
const WebAssembly = WMProf.wrap(globalThis.WebAssembly, {
47+
demangler: swiftDemangler.demangle.bind(swiftDemangler),
48+
});
49+
```
50+
51+
Check the repository for more details.
52+
53+
<img width="1000" alt="swift-wmprof" src="https://github.com/user-attachments/assets/c1da4582-e721-45b9-9bca-ce320711f72d">
54+

0 commit comments

Comments
 (0)