Bugfix/133- fix util unit test memory leak #625
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I use this crate in my project which is sort of a combination of
rtp-to-webrtcandrtp-forwarder. I came to realize that there's memory leak issue and I wish to tackle it. I bumped into Issue#133 and I guess I could start with it and see if some memory leaks can be resolved by tackling it.According to Issue#133. There is memory leak in Util/Turn/Ice/Interceptor detected by nightly-rusts sanitizer.
This PR targets the memory leak issue in Util and hopefully we can tackle other modules in the near future.
vnetis used in unit test and several cyclic dependencies are discovered and resolved by usingWeak<>util::UdpConnowns a map of UdpConn and itself is also added into the map, which creates a cyclic dependency ofArc<>and thus the memory will never be released. The way I see it, Listener already owns the table and should take care of clean-up. The only operationutil::UdpConndo to the map is clean-up the map uponclose. In my opinion it's superfluous and we should just remove the map fromutil::UdpConn.RUSTFLAGS="-Z sanitizer=leak" cargo testin util shows no sign of memory leak anymore.