Re: [Bug 25724] New: Allow garbage collection of closed PeerConnections

On 5/16/14 3:24 AM, Harald Alvestrand wrote:
> I don't understand weak references much, but my understanding is that 
> it doesn't influence garbage collection; if it's a weak reference, and 
> can't be retrieved from the Window object, does it have any effect?

Right, a weak reference presents no obstacle to garbage collection.

> I think the case of having MediaStreams that continue to run despite 
> all references to the PC that Stefan mentioned is important; that's 
> covered if we consider the <video> element to have a reference to the 
> MediaStreamTrack that has a reference to the PeerConnection as long as 
> the track's not "ended".

Right, this is getting detailed, but at a higher level I think we all 
agree that garbage collection, by definition, should never tear down 
anything that is still in use in any way, either directly or indirectly.

 From an implementation pov, as long as the content JS has one reference 
to something that needs the PC either directly or indirectly, it should 
naturally be held alive by any implementation using reference counting, 
for instance. Anything else would be a bug, but maybe I'm too close to it.

.: Jan-Ivar :.

Received on Friday, 16 May 2014 16:01:23 UTC