Bug 50412 - http://www.wunderground.com/US/CA/Hayward.html causes big memory spike during page loading
Summary: http://www.wunderground.com/US/CA/Hayward.html causes big memory spike during...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: http://www.wunderground.com/US/CA/Hay...
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-02 14:43 PST by Antti Koivisto
Modified: 2010-12-07 03:11 PST (History)
6 users (show)

See Also:


Attachments
avoid flattening ropes when creating substrings (9.30 KB, patch)
2010-12-02 15:12 PST, Antti Koivisto
no flags Details | Formatted Diff | Diff
fix build (9.33 KB, patch)
2010-12-02 15:51 PST, Antti Koivisto
barraclough: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Koivisto 2010-12-02 14:43:43 PST
http://www.wunderground.com/US/CA/Hayward.html causes big memory spike (>60MB) during page loading.

The memory i used under this stack:

#0  JSC::JSString::resolveRope (this=0x107cdaa0, exec=0x131b5098) at /Users/antti/jasper/webkit/JavaScriptCore/runtime/JSString.cpp:46
#1  0x00390821 in JSC::JSString::value (this=0x107cdaa0, exec=0x131b5098) at JSString.h:327
#2  0x004ca677 in JSC::JSValue::toThisString (this=0xb01ca590, exec=0x131b5098) at JSObject.h:731
#3  0x004c7978 in JSC::stringProtoFuncSubstr (exec=0x131b5098, thisValue={m_ptr = 0x107cdaa0}, args=@0xb01ca728) at /Users/antti/jasper/webkit/JavaScriptCore/runtime/StringPrototype.cpp:728
#4  0x00420743 in JSC::Interpreter::privateExecute (this=0x9855200, flag=JSC::Interpreter::Normal, registerFile=0x985520c, callFrame=0x131b505c, e
Comment 1 Antti Koivisto 2010-12-02 15:12:03 PST
Created attachment 75418 [details]
avoid flattening ropes when creating substrings

Creating a substring caused the original string be flattened if it was in the rope form. This could use significant amount of memory by reducing buffer sharing between strings.
        
Add a rope specific substring function that constructs the substring by reusing the rope fibers instead of flattening the rope.
        
No change observed in SunSpider.
Comment 2 Darin Adler 2010-12-02 15:13:33 PST
Gavin, you should review this!
Comment 3 Antti Koivisto 2010-12-02 15:19:11 PST
<rdar://problem/8135782>
Comment 4 Early Warning System Bot 2010-12-02 15:36:04 PST
Attachment 75418 [details] did not build on qt:
Build output: http://queues.webkit.org/results/6851004
Comment 5 Antti Koivisto 2010-12-02 15:51:57 PST
Created attachment 75426 [details]
fix build
Comment 6 Build Bot 2010-12-02 15:58:44 PST
Attachment 75418 [details] did not build on win:
Build output: http://queues.webkit.org/results/6811012
Comment 7 Gavin Barraclough 2010-12-02 16:12:40 PST
Comment on attachment 75426 [details]
fix build

r+.

This looks good to me, but please fix up the existing use of int instead of unsigned for the string length, & remove associated casts.
Comment 8 Antti Koivisto 2010-12-07 03:11:36 PST
http://trac.webkit.org/changeset/73433