Mediasoup has memory leak in v3.9.3

Hi, I see mediasoup c++ worker kept using memory even after closing the router with router.close.
So I create one router on one worker on one cpu, then create meeting with some participant(~30-40) I see ram usages go up to ~600 MBs then all participant left and router got closed. but I can see that mediasoup worker is still taking the same amount of memory.

logs for router closing

2022-02-16T11:10:39.078Z mediasoup:Router close()
2022-02-16T11:10:39.078Z mediasoup:Channel request() [method:router.close, id:2785]
2022-02-16T11:10:39.078Z mediasoup:RtpObserver routerClosed()
2022-02-16T11:10:39.079Z mediasoup:Channel request succeeded [method:worker.dump, id:2783]
2022-02-16T11:10:39.079Z mediasoup:Channel request succeeded [method:worker.getResourceUsage, id:2784]
2022-02-16T11:10:39.080Z mediasoup:Channel request succeeded [method:router.close, id:2785]

Double check this, the router.close() if not mistaken only fires the event transportclose and routerclose; and if you aren’t clearing the transports it’d definitely be why you have left over ram. I could be wrong but I recall having this issue before and clean-up was required on my end.

No, it sends a ‘router.close’ message to the worker, and the worker calls the router’s destructor, which deletes all related objects. Everything is pretty straightforward there.

well I am sure that I close all the producer, consumer, transports before closing router. But router.close request destruct the router which destruct the transport available in the map of router instance and then destruct transport which destruct all producer and consumer inside the transport.

Is it still the case for you or were you able to find the root cause of it ?! I am having a similar observation as you have mentioned.