[Webkit-unassigned] [Bug 28876] [Qt] reduce peak memory consumption of text decoding.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Sep 3 02:06:32 PDT 2009


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


Ariya Hidayat <ariya.hidayat at trolltech.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #38868|review?                     |review-
               Flag|                            |




--- Comment #3 from Ariya Hidayat <ariya.hidayat at trolltech.com>  2009-09-03 02:06:32 PDT ---
(From update of attachment 38868)

> +    // We chop input buffer to smaller buffers to avoid excessive memory consumption
> +    // when the input buffer is big.  This helps reduce peak memory consumption in
> +    // mobile devices where system RAM is limited.
> +    static const int kInputChunkSize = 32 * 1024;

In Qt we don't use Hungarian notation :) You can safely drop "k" prefix there.

> +    const char* buf = bytes;
> +    const char* end = buf + length;
> +    String unicode;
> +
> +    while (buf < end) {
> +        int size = end - buf;
> +        size = qMin(size, kInputChunkSize);
> +        QString decoded = m_codec->toUnicode(buf, size, &m_state);
> +        unicode.append(decoded);
> +        buf += size;
> +    }

While this reduced the peak heap, my concern is the speed. Because we append a
small block every time, String needs to grow and reallocate.
Also QTextCode constantly allocates and deallocates 32KB QString.

Can you use Valgrind to see the difference in the memory consumption?

Can we perhaps specify the inputChunkSize, say a small value for Symbian but a
larger one for other platforms?

r- until these issues are addressed.

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