DemonMartin / tlsClient

A wrapper for bogdanfinn/tls-client based on ffi-rs for unparalleled performance and usability. Inspired by @dryft/tlsclient.
https://www.npmjs.com/package/tlsclientwrapper
22 stars 2 forks source link

[BUG] Memory Issue/Ineffective Garbage Collection #4

Open DemonMartin opened 4 months ago

DemonMartin commented 4 months ago

I'm running into problems with memory leaks and ineffective garbage collection.

Steps to Reproduce

  1. Create an instance of the TlsClient wrapper.
  2. Perform a network request using the instance.
  3. Terminate the worker pool.
  4. 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!

guyedry1 commented 2 months ago

a solution for this will be amazing. cant run many instances because of that.