[whatwg] Worker lifecycle

Maciej Stachowiak mjs at apple.com
Thu May 28 03:34:52 PDT 2009


On May 28, 2009, at 2:29 AM, Ian Hickson wrote:

>
> I just checked in a substantial change to the lifetime model for  
> workers.
> Instead of being bound to their ports, which became especially hard to
> implement for shared workers, they now just live as long as the  
> Document
> that created them (all of the Documents that obtained them, for shared
> workers), with this ownership inheriting to nested workers.
>
> I also removed the various ways to observe the lifetime,  
> namely .active
> and the 'close' events.
>
> I hope this will make the shared workers easier to implement. Please  
> let
> me know if this screws anything up for dedicated workers.

I'm assuming this is one of the changes:

> User agents must either act as if MessagePort objects have a strong  
> reference to their entangled MessagePort object or as if each  
> MessagePort object's owner has a strong reference to the MessagePort  
> object.

It seems to me the second alternative prevents MessagePorts created by  
a Window from ever being garbage collected until the user leaves the  
page. Is that a correct understanding? If so, that seems like it could  
create unbounded memory leaks in long-running Web applications that  
use MessagePorts, even if all references to both endpoints of the  
MessageChannel are dropped. That seems unacceptable to me, unless I  
misunderstood.

Regards,
Maciej



More information about the whatwg mailing list