This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 25724 - Allow garbage collection of closed PeerConnections
Summary: Allow garbage collection of closed PeerConnections
Status: RESOLVED FIXED
Alias: None
Product: WebRTC Working Group
Classification: Unclassified
Component: WebRTC API (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Adam Bergkvist
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-15 10:21 UTC by Harald Alvestrand
Modified: 2016-01-19 03:05 UTC (History)
3 users (show)

See Also:


Attachments

Description Harald Alvestrand 2014-05-15 10:21:29 UTC
At the moment, the webrtc specification says:

4.3.3 Garbage collection

A Window object has a strong reference to any RTCPeerConnection objects created from the constructor whose global object is that Window object.

In other words, RTCPeerConnections can't be garbage collected.

In certain applications, where a lot of connections are created, used and closed, this is a Bad Thing, since you can't get rid of old, closed PeerConnections, and you can't reuse them either (there's no return from the "closed" state).

Proposal 1: Replace the text with:

A Window object has a strong reference to any RTCPeerConnection objects created from the constructor whose global object is that Window object, and whose RTCSignalingState is not "closed".

Proposal 2 (less artificial):

An RTCPeerConnection is considered to have a strong reference to it from the Window object that was the global object of the constructor as long as any event can cause a handler to be triggered on the object. When the RTCSignalingState is "closed", no such handler can be triggered.

In either proposal, it might be good to add:

All RTCDTMFSender objects, RTCDataChannel objects and MediaStreamTrack objects that are connected to a PeerConnection are considered to have a strong reference to the PeerConnection object.
Comment 1 Harald Alvestrand 2014-06-27 11:21:41 UTC
There seems to be consensus that garbage collection of PeerConnections that are not in use in any way should happen.

I suggest that Adam (or someone else, assigning to Adam as a marker that this is ready for editors to edit) formulate text that says that; proposal 2 above with addendum seems like an OK starting point.