threads.js: Thread Pool has Memory leak Issue

Hi,

I was using the thread pool 0.7 for my company app to handle processing of large array of json objects. Seems like pool.send(objs) will leave objs inside the job .send returns and stays in memory for quite a long time. I had to call

job.once('done', function(stats){ ....... delete job.sendArgs; // to mark it for GC delete job.runArgs; job.removeAllListeners(); job = null; })

to prevent the leak. Please use memwatch to measure the memory footprint.

Thanks,

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 20 (10 by maintainers)

Most upvoted comments

Sorry for the delay. No the issue still exists. The cause of the memory leak is due to job has a reference to pool via job.pool which formulates a circular dependency. Make sure when job.on done, job.pool is deleted.