[Webkit-unassigned] [Bug 27538] Qt memory consumption on site with many images

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Sep 28 07:41:56 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=27538





--- Comment #19 from Simon Hausmann <hausmann at webkit.org>  2009-09-28 07:41:56 PDT ---
Here's a copy of Holger's earlier explanations about the current work:

[10:53] let me start with theory of operation. ImageSource has a ImageDecoder,
ImageDecoder gets the encoded data and has access to the decoded frames
[10:54] the WebCore::Cache will ask the ImageSource to drop decoded image data
to safe memory, then ImageSource will ask the decoder to free things
[10:56] Qt is working a bit differently. The QPixmaps will never be freed
[10:56] and the decoded frame (QImage) will be freed when we ask for the
QPixmap
[10:58] so everyone has a delete in FrameData::clear, but Qt doesn't...
[10:58] the problem with this are: QPixmap/QImage are not subject to the cache
control (ofcourse when the ImageSource says bye bye... the QPixmap/QImage will
go away too)
[10:58] and mixing WebCore decoders and Qt decoders is not possible
[11:00] the Cache Control can be seen on sites with many pictures (e.g. the
test case I sent around)

 for the patches
[12:23] the overall goal is: a) Control image caching through WebCore::Cache b)
be able to use webcore image decoders
[12:23] for a) CachedImage is doing a calculation like: width*height*depth
bytes are allocated by ImageSource
[12:24] then CachedImage asks ImageSource to clear the cache, FrameData gets
cleared, the QPixmap stays
[12:24] the cache thinks that width*height*depth bytes are allocated less...
which is not really true for QPixmap on QWS, and not nice to abuse the xserver
[12:25] to make that change, we will need to delete the pixmap/NativeImagePtr
m_frame in FrameData::clear (ImageQt.cpp) and change the ownership of the
QPixmap (from ImageDecoderQt) to ImageSource
[12:26] my patch is doing it in a probably too radical way, I replace the old
ImageDecoderQt crap with new one. :}

[12:29] so my changes are doing the following: Remove ImageDecoderQt the
ImageHandler, start to decode the image only when someone asks for the frame or
the size
[12:29] and use the RGBA32Buffer class to store them, to more or less behave
like a normal ImageDecoder (e.g. the GIF one)

[13:27] <tronical> zecke_: otherwise the changes look good. the only thing I'm
wondering is how hard it'll be to add support for qt image decoders for other
unsupported formats.
[13:28] <zecke_> tronical: by default QImageReader/ImageDecoderQt is used
[13:29] <zecke_> tronical: so the place I have put the code is like. If it is
configured that way, then use GIF, JPEG, PNG, ICO, BMP from WebCore and
fallback to ImageDecoderQt then

[14:06] <zecke_> tronical: and the idea is that we have a WTF::Vector for the
image data and QImage on top, for the WebCore decoders we could do color space
conversion on decoding (to device depth), for QImageReader we have to
convert/copy...
[14:07] <zecke_> tronical: the main benefits that I can not yet prove are: Less
decoding during loading, better cache behavior

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list