[whatwg] Low Memory Event

Charles Pritchard chuck at jumis.com
Sat Jan 1 12:39:26 PST 2011


On 1/1/2011 12:08 PM, whatwg-request at lists.whatwg.org wrote:
> Date: Fri, 31 Dec 2010 22:01:42 -0600 From: Boris Zbarsky 
> <bzbarsky at MIT.EDU> On 12/31/10 7:35 PM, Charles Pritchard wrote:
>> >  If I were to receive an event, letting me know a low memory condition
>> >  exists
> There are various ways to try to work around this by trying to
> pre-reserve a memory pool, but they're not very reliable.  I suggest
...
> get deallocated until garbage collection happens.  Garbage collection
> can require memory to perform.  In the case of Gecko, collecting
...
> So by the time you're out of memory, doing this is too late.  It won't work.
>
...
> And significantly greater implementation complexity for browsers if they
> try to make it work.  And it still wouldn't work.
...
> Then get desktop OS vendors to give applications a way to detect low
> memory reliably.

Implementation details would not be defined by the spec.

Implementation fo the event type would be low-cost, backward compatible, 
and a simple entry to existing spec docs.
"lowmemory" does not need to mean that the OS is experiencing a low 
memory condition.

Here are some example implementations; it's up to the vendor, not the spec.

Tabbed browsing implementation:
Send a lowmemory event to hidden tabs listening (for lowmemory), that 
have not been visible for more than 60 seconds.
(This is a partial example, as it doesn't detail when the tabs would be 
checked for visibility. )

The example requires no OS mem-warnings and would allow use cases such 
as mine, to clean up a little, when lowmemory is fired.

Mobile implementation:
Mobile operating systems have lowmemory warnings, they are important for 
the durability of web apps running in mobile browsers.

"Expensive" implementation:
My mail client and web clients often compete with each other for memory: 
Mozilla apps drop image icons, WebKit crashes tabs.
After a few tabs are crashed, or a few icons are dropped, they could 
certainly send a lowmemory event to remaining listeners.

-Charles


More information about the whatwg mailing list