Created attachment 46705 [details]
Memory allocated for CanvasRenderingContext2D never gets freed. Simply calling getContext('2d') and never doing anything with it nor its <canvas> will eat all your memory. See the attachment for a simple example (and remember to monitor your memory usage).
Creating a canvas element by itself (without accessing the rendering context) doesn't leak any memory.
Firefox exhibits the same "nom nom nom" behavior, but - unlike WebKit - frees the gobbled up memory after a while. I do not know the inner workings of the canvas element, but I take it that there is a reason why neither WebKit nor Firefox free the memory immediately when [from my point of view] it's no longer in use at all; I hope someone can educate me on this one. Would it at least be possible to implement some kind of timed garbage collection?
Curiously we _do_ do periodic gc, so i wander what's happening. The logical conclusion is that the canvas is remaining live for some reason...
(i haven't verified that i see the leakage however)
(In reply to comment #1)
> Curiously we _do_ do periodic gc, so i wander what's happening. The logical
> conclusion is that the canvas is remaining live for some reason...
I don't believe we actually do a periodic gc. We do a gc on navigation though.
Would someone mind at least confirming the issue?
Sure, but we don't usually differentiate between the UNCONFIRMED and the NEW state.
Is the issue perhaps that CanvasRenderingContext2D doesn't call reportExtraMemoryCost()?