[CLI] Limit the number of decoded images in memory
See original GitHub issueI’m trying edit folder with approx 200 images within npx @squoosh/cli --mozjpeg '{"quality":80}' -d . ./*.jpg
and get memory error:
1.54MBRangeError: WebAssembly.Memory(): could not allocate memory at /Users/illy/.npm/npx/83877/lib/nodemodules/@squoosh/cli/build/index.js:7:176011 at instantiateEmscriptenWasm (/Users/illy/.npm/npx/83877/lib/nodemodules/@squoosh/cli/build/index.js:7:153532) at Object.dec (/Users/illy/.npm/npx/83877/lib/nodemodules/@squoosh/cli/build/index.js:7:378727) at decodeFile (/Users/illy/.npm/npx/83877/lib/nodemodules/@squoosh/cli/build/index.js:7:520969) at async MessagePort.<anonymous> (/Users/illy/.npm/npx/83877/lib/nodemodules/@squoosh/cli/build/index.js:7:493320) Worker error: Error [RuntimeError]: abort(RangeError: WebAssembly.Memory(): could not allocate memory). Build with -s ASSERTIONS=1 for more info.
Terminal blinking and process never ending.
Thanks
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:8 (3 by maintainers)
Top GitHub Comments
CLI should probably limit parallel execution by number of cores. /cc @surma
Another good option for controlling the amount of concurrrency when dealing with lots of tasks as promises would be https://www.npmjs.com/package/p-map