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