On Wed, Feb 9, 2011 at 5:26 PM, Glenn Maynard <glenn@zewt.org> wrote
>
>
> On a related note, please see this statement from section 5.5 of the
>> MessagePort spec:
>>
>> Authors are strongly encouraged to explicitly close MessagePort<http://dev.w3.org/html5/postmsg/#messageport> objects
>> to disentangle them, so that their resources can be recollected. Creating
>> many MessagePort <http://dev.w3.org/html5/postmsg/#messageport> objects
>> and discarding them without closing them can lead to high memory usage.
>>
>
> For explicitly-created MessagePorts this is natural enough. It's slightly
> less obvious for MessagePorts created implicitly by Worker/SharedWorker
> objects, though; I'd predict that becoming a common cause of leaks on pages
> that create and destroy a lot of threads.
>
It's not an issue, because when a Worker shuts down it implicitly closes all
of its MessagePorts, which would allow the renderer side to be GC'd - the
leak only happens when you release a reference to a MessagePort without
closing it. If you're creating lots of worker threads and leaving them
running, then you've got bigger memory issues than a few hundred bytes of
MessagePorts.
But, yeah, back to IDB now :)