[Webkit-unassigned] [Bug 63918] [JSC] WebKit allocates gigabytes of memory when doing repeated string concatenation

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jul 4 19:25:52 PDT 2011


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


Dominic Cooney <dominicc at chromium.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|JS allocates gigabytes of   |[JSC] WebKit allocates
                   |memory on WebKit            |gigabytes of memory when
                   |                            |doing repeated string
                   |                            |concatenation
             Status|UNCONFIRMED                 |NEW
                 CC|                            |dominicc at chromium.org,
                   |                            |ggaren at apple.com
     Ever Confirmed|0                           |1




--- Comment #1 from Dominic Cooney <dominicc at chromium.org>  2011-07-04 19:25:52 PST ---
I debugged this a little, and I observed the JSC GC is allocating JSStrings with two fibers during string concatenation. These JSC heap objects are small, so JSC GC is not triggered. However there is a lot of string copying in the C++ heap, which is where I think the heap growth comes from.

OP: If you need a workaround, which is probably fragile, you can trick JSC into creating strings with three pieces, which have a different code path, by doing something like changing:

for (var i = offs; i < offs + 10; ++i)
  dest += dest[i];

to this:

for (var i = offs; i < offs + 10; i += 2)
  dest = dest + dest[i] + dest[i + 1];

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