W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2011

[whatwg] Low Memory Event

From: Charles Pritchard <chuck@jumis.com>
Date: Fri, 07 Jan 2011 16:16:30 -0800
Message-ID: <4D27ACDE.3030006@jumis.com>

> Date: Sun, 02 Jan 2011 04:59:14 -0600 From: Boris Zbarsky 
> <bzbarsky at MIT.EDU> On 1/1/11 6:53 PM, Charles Pritchard wrote:
>> >  ArrayBuffer and Canvas use contiguous memory segments. You don't need a
>> >  complex GC pass to let those ones go.
> Yes, you do.  You can't let go of the canvas buffer without letting go
> of the canvas rendering contexts and canvas elements referencing it.
> And those used to be referenced from JS, so the only way they can go
> away is via a GC.
> Similar for ArrayBuffer: the memory segment is owned by various
> garbage-collected objects, and can't go away until they do.
With canvas, you can just set  canvas.width = 1; to let the memory go, 
without a complex GC.
canvas.width = 1 can be used to quickly release several megs of ram.

On that note, a method of invalidating ArrayBufferView and 
CanvasPixelArray would be helpful in the future.
Maybe that's something we could talk about, as we discuss the 
feasibility of responding to lowmemory events.

Here's a thread considering .close() as an invalidate method name:

And here's a quick attempt at example, on my part:

el.onclick = function() {
// imageData.data[0] = 0; now throws INVALID_STATE_ERR from this thread

.close() signals to postMessage to use a pointer, instead of cloning the 
Received on Friday, 7 January 2011 16:16:30 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:29 UTC