-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maybe memory leak? #667
Comments
Hello, the first thing to try is to force a garbage collection. Please can you start Electron with input.then(data => {
return Sharp(data, opts)
.toFile(dest);
}).then(global.gc); |
Hi, thanks for your quick reply. I have updated the code to : input.then(data => {
return Sharp(data, opts)
.toFile(dest);
}).then(global.gc); But it seems still have two problems:
|
The final The Node/Electron process will grab as much memory as it can before resorting to a GC. If you artificially limit the memory assigned to the process, it will trigger GC more often and free no-longer referenced Buffer data. See #429 for a more thorough discussion of the memory usage with various versions of Node. |
Thanks for your answer! I fixed the problems. |
Hi,
I was building a texture packer with sharp, and i use
sharp.overlayWith
to pack small pictures to a big picture.I found the way to overlay multiple pictures to a picture in #405. But it seems this will increase memory usage to a huge number and memory will not be release.
Before pack textures: memory usage 88.8 m
After pack textures: Memory usage 1.67 g
I have also disable the cache with
sharp.cache(false)
, but it has no effect.The example is here: https://github.com/2youyou2/electron-pitfalls
Please follow these steps:
Thanks for looking this.
The text was updated successfully, but these errors were encountered: