Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/fix interceptor/webrtc unit test memory leak #629

Merged

Conversation

mutexd
Copy link
Contributor

@mutexd mutexd commented Nov 10, 2024

This PR fixes the memory leak warning in interceptor and webrtc

  1. Fix MockStream cyclic dependency to itself (interceptor)
  2. Fix self reference test case in data_channel_test.rs (webrtc/data_channel)
  3. Fix cyclic dependency for dtls_transport (webrtc/peer_connection)
  4. Fix cyclic dependency between PeerConnectionInternal and StatsInterceptor (webrtc/peer_connection)

Related issue #133
RUSTFLAGS="-Z sanitizer=leak" cargo test ` on the whole project shows no sign of memory leak.

- it often binds itself into Interceptor and owns the returned sender/writer. The returned sender/writer might contain the Arc<> to MockStream itself. Thus, the cyclic dependency is formed. We create an internal struct to avoid this.
…ptor

- PeerConnectionInternal should not own StatsInterceptor. Make it Weak<>
- IceTransport holds OnConnectionStateChangeFn, which hods DtlsTransport and DtlsTransport holds IceTransport. In the callback we should use Weak<>
@yngrtc yngrtc merged commit 8db3679 into webrtc-rs:master Nov 10, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants