[BUG] Memory Issue/Ineffective Garbage Collection
I'm running into problems with memory leaks and ineffective garbage collection.
Steps to Reproduce
- Create an instance of the TlsClient wrapper.
- Perform a network request using the instance.
- Terminate the worker pool.
- Observe the memory not fully freeing up, leading to gradual memory build-up.
The test.js includes parts of the test I tried using Heap Snapshots
Expected Behavior Memory is completely freed up when the worker pool is terminated, preventing any leaks and allowing for long-term stable memory usage.
Actual Behavior Some memory remains allocated after the worker pool is terminated, leading to eventual memory overflow and crashing the application.
I've tried various approaches to identify and fix the underlying cause but haven't had any success so far.
Thanks!
a solution for this will be amazing. cant run many instances because of that.
has solution was found?
@pepedro12 Considering I switched to use koffi and a session/module logic, it's slightly better than when I opened this issue. Sadly it's still not optimal. It's very CPU/RAM heavy; That might be caused by Node.js itself.
If you correctly implement it and make Sure to not use too many threads (default value is fine), then it works good.