<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>25724</bug_id>
          
          <creation_ts>2014-05-15 10:21:29 +0000</creation_ts>
          <short_desc>Allow garbage collection of closed PeerConnections</short_desc>
          <delta_ts>2016-01-19 03:05:50 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebRTC Working Group</product>
          <component>WebRTC API</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Harald Alvestrand">harald</reporter>
          <assigned_to name="Adam Bergkvist">adam.bergkvist</assigned_to>
          <cc>nick</cc>
    
    <cc>public-webrtc</cc>
    
    <cc>rolly</cc>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>106028</commentid>
    <comment_count>0</comment_count>
    <who name="Harald Alvestrand">harald</who>
    <bug_when>2014-05-15 10:21:29 +0000</bug_when>
    <thetext>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&apos;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&apos;t get rid of old, closed PeerConnections, and you can&apos;t reuse them either (there&apos;s no return from the &quot;closed&quot; 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 &quot;closed&quot;.

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 &quot;closed&quot;, 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108420</commentid>
    <comment_count>1</comment_count>
    <who name="Harald Alvestrand">harald</who>
    <bug_when>2014-06-27 11:21:41 +0000</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110453</commentid>
    <comment_count>2</comment_count>
    <who name="Adam Bergkvist">adam.bergkvist</who>
    <bug_when>2014-08-22 08:53:31 +0000</bug_when>
    <thetext>Proposed fix: https://github.com/fluffy/webrtc-w3c/commit/e8b84dbc739279ab4b4d30f8a8d9c4e500638dcb</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>