Here are instructions for making a custom build of the deno
executable that supports heap memory limits on web workers via an environment variable called WEB_WORKER_HEAP_LIMIT_BYTES
.
Note that, unfortunately, this does not limit "Large Object Space" allocations, since V8 makes those allocations outside the heap. This includes e.g. large ArrayBuffers, Typed Arrays, and potentially other stuff. I've opened an issue about this here: denoland/deno#26202
git clone --recurse-submodules --branch v2.0.0 https://github.com/denoland/deno.git
cd deno