From 18fa441ff879b866e44f3bf94f5003d8dfe88643 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 9 Dec 2024 00:34:30 +0900 Subject: [PATCH] Update debugging.md --- src/getting-started/debugging.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/getting-started/debugging.md b/src/getting-started/debugging.md index 001eaf3..f5f7898 100644 --- a/src/getting-started/debugging.md +++ b/src/getting-started/debugging.md @@ -36,4 +36,19 @@ assume the availability of JavaScript to make debugging easier. ## [wasm-memprof](https://github.com/kateinoigakukun/wasm-memprof) If you are debugging memory leaks, [wasm-memprof](https://github.com/kateinoigakukun/wasm-memprof) can help you. -It is a tool to profile memory usage of WebAssembly applications with minimal setup. Check the repository for more details. +It is a tool to profile memory usage of WebAssembly applications with a few lines of setup code: + +```javascript +import { WMProf } from "wasm-memprof"; +import { SwiftDemangler } from "wasm-memprof/plugins/swift-demangler.js"; + +const swiftDemangler = SwiftDemangler.create(); +const WebAssembly = WMProf.wrap(globalThis.WebAssembly, { + demangler: swiftDemangler.demangle.bind(swiftDemangler), +}); +``` + +Check the repository for more details. + +swift-wmprof +