Skip to content

Release and reacquire memory #1396

Open
@penzn

Description

@penzn

Originally posted by @photopea in #1300 (comment)

My visitors spend hours on my website without reloading it.

My wasm program runs once every 5 minutes, for 0.5 seconds each time. It is called by a synchronous JS function, which expects the output right after the wasm finishes. During the execution, the wasm program needs 700 MB of RAM.

I would like to release these 700 MB when the wasm program does not run. What JS object should I release (remove references to)? Next time my JS function runs, I want to run the wasm program again (in a synchronous way).

I was thinking about recompiling WASM each time my JS function runs, but all current browsers compine WASM asynchronously. Is there anything else I can do?

These lines do nothing:

wasm.instance.exports.memory.buffer = new ArrayBuffer(10);
wasm.instance.exports.memory = new WebAssembly.Memory({initial:10});

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions