Looking into javascript types I\'m trying to find out what the maximum storage size for some data types are. For instance, I set up a quick recursive algo to increase var si
ECMA section 6.1.4 is explicit about this.
"The String type is the set of all ordered sequences of zero or more 16-bit unsigned integer values (“elements”) up to a maximum length of 2^53-1 elements"
As you already stated, the specification does not state any size limits / requirements for types besides Number
.
So this is definitally left to the implementation.
For example, Chrome's limit on strings seems to be hard coded at around 512mb (and less on 32bit).
This puts a limit on the maximally possible allocation request in 32-bit versions of 2^27-1. The maximal flat string length is ~2^28 (512MB space), and the maximal string length is 2^29-1, so neither of these limits catch the problem (we would throw an Out-Of-Memory exception instead if they did).
See: http://code.google.com/p/v8/issues/detail?id=362#c9
As far as the other browsers go, this would need some research e.g. looking into Firefox's code. But I doubt we can do the same for IE / Opera.
I have listed some typical limits for strings in another answer. Basically, you are in safe territory up to a string length of 227 characters.