'Javascript maximum size for types?

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 size till the browser crashes, which ends up being somewhere close to 128mb (or maybe it's 256) for strings on my existing version of chrome.

I've been doing it the painful way because I couldn't find any specs on this, but constant browser crashes make this a painful trial (try catch seems useless for some reason with this particular issue).

I'm looking for information about maximum storage size for the other types also (array, object, functions, strings, numbers, bools...)

EMCA-262 section 8.4 is vague on this

The length of a String is the number of elements (i.e., 16-bit values) within it. The empty String has length zero and therefore contains no elements.

...so perhaps this is something that needs to be identified as implemented in browsers?

ECMA does however tell us about numbers, for example,

The Number type has exactly 18437736874454810627 (that is, 2^64−2^53+3) values, representing the double-precision 64-bit format IEEE 754 values as specified in the IEEE Standard for Binary Floating-Point Arithmetic, except that the 9007199254740990 (that is, 2^53−2) distinct “Not-a-Number” values of the IEEE Standard are represented in ECMAScript as a single special NaN value.

But then I don't see anything about objects.

What can I expect for use in browsers? Is there any code-base out there that helps manage very large objects and strings?

How much memory can I allocate in a single script?



Solution 1:[1]

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"

Solution 2:[2]

I am experiencing this currently, I can not send the results back via json as it is html based. And the data is truncated to a specific size, and the excess data is dropped. I am not positive yet on the number of characters in the returned results, but it is far less then 2^27...

Solution 3:[3]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jens Fiederer
Solution 2 Peter
Solution 3 Community