Closed
Description
There is a memory leak in the current stable version of node-canvas.
Steps to Reproduce
- Start some program to observe system memory
- Run the following code in node (set url to some Jpg file):
const canvas = require('canvas');
const loadImageNTimes = n => {
if (n > 0) {
const image = new canvas.Image();
image.onload = () => {
// Uncomment the following line to free image memory:
// image.src = '';
loadImageNTimes(n - 1);
};
image.src = 'some.jpg'; // Set Url to an existing Jpg file
}
};
loadImageNTimes(500);
- You should see that the memory is now growing linearly
- Uncomment the line
image.src = ''
and run the script again - The memory stays constant now
Environment:
- node-canvas 1.6.10
- node 9.11.1 on Ubuntu 17.10
Metadata
Metadata
Assignees
Labels
No labels