-
Notifications
You must be signed in to change notification settings - Fork 125
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
Memory Leak #46
Comments
I'm not able to reproduce with the test image provided in that issue on jpeg-js v0.3.4 (or with another large image I had lying around). Using latest JIMP on that image I also don't see any memory leak on my system. Environment If you're able to narrow down the repro to a specific environment and test file. I can take a deeper look. |
@patrickhulce did you happen to run it in a loop? |
Yep, I did ~20 iterations. Here's my code and output for posterity. var JIMP = require('jimp')
var fs = require('fs')
// File from #153
var file = fs.readFileSync('file.jpg')
;(async () => {
var image = null
for (let i = 0; i < 20; i++) {
console.time('decode')
image = await JIMP.read(file)
console.timeEnd('decode')
const used = process.memoryUsage().heapUsed / 1024 / 1024
console.log(`Using approximately ${used} MB`)
}
console.log('bitmap length', image.bitmap.data.length)
})() Output
|
@aperkaz from the conversation above, I was not able to observe anything that needs fixing. I'm not aware of any memory leak in jpeg-js, if you have reproducible code and data for this that you can share. Please do. |
Hi @patrickhulce, the read operation isn't the problem. But if I call an image operation - in my case rotate - i get the following: const image = await jimp.read(url);
image.rotate(90); I don't know if the rotate-operation is part of jpeg-js or another Jimp library (@hipstersmoothie). I only have 1 GB RAM on backend side and Jimp allocates 800 MB of it, if I call the rotate operation. |
Then it's completely unrelated to jpeg-js and it's a JIMP issue. jpeg-js is only for reading and writing JPEGs. This further confirms that the memory issues are not coming from jpeg-js. |
Per #46 (comment) and #46 (comment) there is no observable memory leak from jpeg-js alone. Additionally #54 has introduced fine-grain controls over jpeg-js memory usage, so we'll consider this resolved. |
There seems to be a memory leak in jpeg-js. Details here: jimp-dev/jimp#153
The text was updated successfully, but these errors were encountered: