diff --git a/README.md b/README.md index 78953341..ed02afdf 100755 --- a/README.md +++ b/README.md @@ -192,6 +192,8 @@ This package also ships a pure WebAssembly artifact built with `wasm-bindgen` to const resvgJS = new resvg.Resvg(svg, opts) const pngData = resvgJS.render(svg, opts) // Output PNG data, Uint8Array const pngBuffer = pngData.asPng() + pngData.free() // Free memory + resvgJS.free() const svgURL = URL.createObjectURL(new Blob([pngData], { type: 'image/png' })) document.getElementById('output').src = svgURL })() diff --git a/wasm/index.html b/wasm/index.html index 35471f86..d519f4e5 100644 --- a/wasm/index.html +++ b/wasm/index.html @@ -320,6 +320,9 @@ const pngData = resvgJS.render() const pngBuffer = pngData.asPng() + pngData.free() + resvgJS.free() + document.querySelector('#output img').src = URL.createObjectURL( new Blob([pngBuffer], { type: 'image/png' }) )