[whatwg] Low Memory Event

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 :)

Received on Monday, 27 September 2010 16:01:20 UTC