You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding sharp.cache(false) does not fix this problem.
What are the steps to reproduce?
git clone https://github.com/ollm/electron-sharp-memory.git
cd electron-sharp-memory
npm install
npm start
Currently, when using Sharp on some Linux distributions through Electron, memory is not being released. To try to fix this, I've tested using global.gc() or moving Sharp into node:worker_threads, but neither worked.
When running the same Sharp script directly in Node, memory usage grows to about 200-500 MB and then stabilizes, but inside Electron it keeps increasing without stopping.
Possible bug
Is this a possible bug in a feature of sharp, unrelated to installation?
npm install sharpcompletes without error.node -e "require('sharp')"completes without error.Are you using the latest version of sharp?
sharpas reported bynpm view sharp dist-tags.latest.What is the output of running
npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?Does this problem relate to file caching?
sharp.cache(false)does not fix this problem.What are the steps to reproduce?
Currently, when using Sharp on some Linux distributions through Electron, memory is not being released. To try to fix this, I've tested using
global.gc()or moving Sharp intonode:worker_threads, but neither worked.When running the same Sharp script directly in Node, memory usage grows to about 200-500 MB and then stabilizes, but inside Electron it keeps increasing without stopping.
I've read issues #667 and #955.
It may also be related to #4351 and electron/electron#46323
In Electron, Ubuntu 24.04.3 (Memory increases):
Videograbacion.2025-10-03.09.26.12.mp4
In Node, Ubuntu 24.04.3 (Memory remains stable):
In Electron, Arch Linux (Memory remains stable, but not when running inside a Flatpak package):
Videograbacion.2025-10-03.10.20.26.mp4
What is the expected behaviour?
That memory usage should be similar to running Sharp directly in Node.
Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem
Electron sample app and
app.js