geotiffjs / geotiff.js

geotiff.js is a small library to parse TIFF files for visualization or analysis. It is written in pure JavaScript, and is usable in both the browser and node.js applications.
https://geotiffjs.github.io/
MIT License
845 stars 175 forks source link

Pool workers lead to memory leak? #410

Closed reyemtm closed 8 months ago

reyemtm commented 8 months ago

In NodeJS, the pool seems to keep spawning workers and not closing them, or not closing them soon enough, leading to a 1.5G memory usage without to use the max memory available. Is there a way to check and see if the pool is active and if so destroy it?

reyemtm commented 8 months ago

I think I figured it out.

Ottozz commented 2 months ago

Do you mind sharing how you figured it out? I'm facing the same issue.

reyemtm commented 2 months ago

You need to make sure you are not constantly opening a new pool but instead actually using the same pool for each call, instantiated at a higher level, if that makes sense.