I have created a JSFiddle to see how much data I can push into my browser.
The link is http://jsfiddle.net/GWxAk/
The code is simple. It\'s just trying to p
Again, my machine with 16GB of RAM. I can watch the browser RAM usage climb as it increases, so I would assume it's limited by RAM as well.
IE crapped out at 16,840,000
Chrome at 14,850,000
Firefox 32,890,000
Safari recycles itself around 8,720,000 (LOL @ Apple)
Here is a screenshot of memory usage and firefox http://screencast.com/t/3Xl31yGgHWC
I am ON Chrome and i tried your test and it hangs on the same 14850000 you mentioned even if i only have 2gb of ram and i am running a VM with windows inside my linux installation that i gave 700Mb of ram so i guess yes chrome has a limit
Lets assume UTF8, meaning your 'a' is 2 bytes/8bits.
14,850,000 * 300 = 4455000000 characters
14850000 * 300 * 2 = 8,910,000,000 bytes
As such we can surmise from your test that the maximum length of a string in Chromes JS engine is 4,455,000,000 characters, or ~ 8.3 GB in memory.
But ofcourse this is not what's happening. You only have 4GB of RAM yet ~4298MB has appeared out of nowhere according to the figures, and there's the structures of the array variable itself and the java VM and chrome itself ot account for etc etc
Not to mention that you're pushing s+count not s on its own, so the length of the string being added is rising as the number of digits in count increases. If s was the same, then its likely the value would be interned to save memory by the V8 engine. For reference, the number of additional characters added because of the count variable, and due to it's non linear increase in length, is 9,7438,889 characters or 185.85MB of data.
So something else must be happening here.
As for the limits of the V8 JS engine:
http://code.google.com/p/v8/issues/detail?id=847
The 32bit memory address space is the upper limit, and for 64bit, that link suggest ~1.9GB although it's very much likely to be the upper limit of what your OS can support and is physically available.
So to summarise:
edit:
On a 32-bit machine your upper limit will always be 4GB, no if ands or buts. In practice, it will be wildly different machine to machine (not unusual to have 10+ tabs open)
Best way to go: keep only the data your user is actively working on or anything you can't quickly retrieve from the server handy. Everything else, get when the user asks for it.