Bug 40605 - Excessive memory using when communicating with a worker
Summary: Excessive memory using when communicating with a worker
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac (Intel) OS X 10.6
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-14 19:51 PDT by James
Modified: 2010-07-06 00:05 PDT (History)
2 users (show)

See Also:


Attachments
index.html and worker.js to demonstrate the issue (1.72 KB, application/zip)
2010-06-14 19:51 PDT, James
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description James 2010-06-14 19:51:42 PDT
Created attachment 58742 [details]
index.html and worker.js to demonstrate the issue

using 200,000 'lorem' strings I did a few tests and it looks like simply sending messages between a worker and the thing that created it uses a massive amount of ram, despite the messages not being stored anywhere in JS code.

Below are the tests and the memory usage I got from Activity Monitor. I have also attached the code that can replace this.

sending messages to the worker only
real memory size: 336mb
virtual memory size: 5.02mb
private memory size: 70.1mb
virtual private memory: 309mb

sending messages to the worker and the worker sending the same messages back
real memory size: 533mb
virtual memory size: 5.2gb
private memory size: 112mb
virtual private memory: 663mb

adding strings to an array
real memory size: 103mb
virtual memory size: 4.79gb
private memory size: 58mb
virtual private memory: 202mb

adding strings to an object
real memory size: 128mb
virtual memory size: 4.82gb
private memory size: 87mb
virtual private memory: 262mb
Comment 1 James 2010-06-15 04:32:06 PDT
*replicate
Comment 2 James 2010-07-06 00:05:56 PDT
This looks to actually be an issue with the JSON implementation.

I made a small modification to the array test putting JSON.stringify() around the string and my memory usage went up alot:

real memory size: 512mb
virtual memory size: 5.18gb
private memory size: 484mb
virtual private memory: 649mb