I seem to be getting a rather predictable memory "leak" when using getImageData() on a 2d Canvas Rendering Context. Basically in my test case, i am calling putImageData(getImageData(...), ...) every chance i can get. Memory usage climbs well into the 1 <-> 2gb range. It should be noted that this occurs in other browsers too, though with varying cut-off points (presumably when the garbage collection finally kicks in). However it should also be noted that i am essentially running the same code in a real app, i don't seem to encounter this issue (in WebKit r35620). For reference, i have put a copy of this up at the following URL: http://www.cuppadev.co.uk/hiscumm/webkit-canvas-mem/js_test.html (search for "fastPaletteRemap" if you want the meat of it) As for why this is, i am really stumped. So i can't really rely on it. Any insight would be appreciated of course. :)
Ouch.
JSImageData::JSImageData just needs to call JSC::Heap::reportExtraCost.
JSCanvasPixelArrayCustom already does that -- i suppose if you never used the CPA that would achieve this result but, if you ever did touch it it would report... Hmmmm -- i wonder if we ever get rid of the cached wrapper though?
Created attachment 24004 [details] Fixeration Fix
Comment on attachment 24004 [details] Fixeration r=me
Committing to http://svn.webkit.org/repository/webkit/trunk ... D WebCore/bindings/js/JSCanvasPixelArrayCustom.cpp M WebCore/ChangeLog M WebCore/WebCore.xcodeproj/project.pbxproj A WebCore/bindings/js/JSImageDataCustom.cpp M WebCore/bindings/scripts/CodeGeneratorJS.pm M WebCore/html/CanvasPixelArray.idl M WebCore/html/ImageData.idl Committed r37181