gm icon indicating copy to clipboard operation
gm copied to clipboard

Possible Memory Leak?

Open robaca opened this issue 4 years ago • 0 comments

We are using the d3 module 1.23.1 to create thumbnails for images with code like the following:

this.gm(originalStream, 'someImage.jpg')
    .options({ timeout: 15000 })
    .autoOrient()
    .unsharp(0, 0.5)
    .resize(250, 500, '>')
    .stream('jpg', (err: Error, stdout: any) => {
        if (err) {
            return reject(err)
        }
        const someOutputStream = // create output stream
        stdout
            .pipe(someOutputStream)
            .on('finish', resolve)
            .on('error', reject)
    })

When calling this code multiple times, it seems that d3 stores some buffer references and we have get a memory leak. This is how a diff between two heapsnapshots looks like:

image

Do we have to do some cleanup to finally free resources?

robaca avatar Jul 22 '20 07:07 robaca