[whatwg] Low Memory Event

Dennis Joachimsthaler dennis at efjot.de
Tue Sep 28 01:09:16 PDT 2010

Am 28.09.2010, 01:01 Uhr, schrieb timeless <timeless at gmail.com>:

> tl;dr of my previous post: it's impossible to know how much memory is
> available in the future.

> How much memory you're currently using is something that /could/
> probably be provided in the near future. *However*, there might be a
> concern that this could be abused by attackers trying to figure out
> information about the host environment. Either way, you'll have to
> wait for browsers to finish exposing this to users before it becomes
> exposed to web applications.

How about maybe a percentage of Javascript memory used? We could check
if it goes into critical mass (95 %?) to reduce stored things.

Browsers could enlarge said Javascript memory or make it smaller at will.

> As for canvas sizes... The amount of available ram can easily have
> nothing to do with video graphics surface restrictions. This is a
> distinct requirement (thanks for listing it). I think it's probably
> more reasonable for browsers to provide a hint about this than the
> others. Again there are security concerns, and resource race
> conditons. But if the number is clamped and can somehow float, perhaps
> it's workable. Keep in mind that there could be 5 windows side by side
> each competing to waste e.g. GL contexts on an overly constrained GL
> based system (the embeddings I'm looking at suck like this).
> That leaves the "i want to dump data to cache" case, which is covered
> by "use a timer (even Date()) and figure out if things have slowed too
> much. For this case, you should in theory start by playing with
> localStorage and application-cache.

This gives me an idea. How about if the browser exposed a hint for  
usage. Like "low, medium, high" in context of the Javascript Website.
This means if the processor is at 80 % usage in the OS task manager, it
could still be on "low" for the Javascript application depending on how
much it currently uses. Which means if the Javascript application reaches
"high", it would certainly become unresponsive.

Another example: The OS processor is at 98 %. the Javascript app uses only
1 % of it, but STILL goes "medium" or even "high" because it uses a lot of
the currently available resources.

At some point there should of course be a limit on how much of the  
it CAN use if it idles.

> Automatically tuning is your user's friend. And it doesn't require any
> new apis :)
Virus checked by G DATA AntiVirus
Version: AVB 21.366 from 27.09.2010
Virus news: www.antiviruslab.com

More information about the whatwg mailing list