-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
Issue
Calling the utility method loadImage
(or just using the Image
object for the matter) does not release the memory used.
The same happens with both local and remote images. Loading a 3MB remote jpg in the below example would keep the rss memory at ~400MB and would not be GCed.
Awaiting for the promise to resolve, setting the returned image to null / the source to null makes no difference to the memory level.
Steps to Reproduce
const { loadImage } = require('canvas')
for (let i=1; i<=10; i++) {
loadImage('path_to_image').then(function(){
console.log('loaded')
})
}
setInterval(()=>{
if (global.gc) { global.gc() }
console.log('rss: ' + process.memoryUsage().rss / (1024 * 1024) + 'MB')
}, 1000)
Your Environment
- Version of node-canvas: 2.6.1 built from source
- Environment: node 12.19.1 & node 14.15.1 on MacOS 10.13.6 & Heroku 18 stack (Ubuntu 18.04)
Keylekan, gerbenmeyer, ArmorDarks, AbdulDridi, Arhusien and 1 more
Metadata
Metadata
Assignees
Labels
No labels