[whatwg] Low Memory Event

Rob Evans rob at mtn-i.com
Mon Sep 27 16:16:15 PDT 2010


All good points. I think as we have moved away from simple web pages and
really start to think about applications that are coded in js, many things
previously the exclusive domain of desktop apps are more and more desirable
for web apps.

I also think that a web page should be able to request exclusive access to
the graphics card just like many native games do, and that the user need not
be aware that anything different has occurred because the browser can simply
pause other processes that are not in focus.

I realise the technical aspects of doing that are mega complex. For one,
each process that is currently using the gpu would ned to be signaled that
it no longer has access at the moment and to pause itself, but then again,
desktop apps have had to deal with these events for ages.

It's been a while but I remember coding a similar event handler for when a
user pressed the windows key and suddenly my game was minimised. If I
remember correctly, I had to re-initialise direct x or open gl before I
could continue processing.

Can't we have something similar on a browser with js events?

Somewhere down the road I guess!

On 28 Sep 2010 00:01, "timeless" <timeless at gmail.com> wrote:

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.

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.

Automatically tuning is your user's friend. And it doesn't require any
new apis :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100928/729ec25a/attachment-0002.htm>


More information about the whatwg mailing list