I have never heard of a limit on any kind of object without throwing a memory error. What is the limitation, is it memory, cpu or is there a specific index limit? I'd love to contribute some docs about it in the correct places
I think it reached about 500k - it was for sure an anti-pattern but it just made me curious on whether the spec was to do with memory or quantity. Can you have more if you give the engine more memory?
Why a limit anyways? What is actually happening in Promise.all that would require a limit?
arguments.length has to be an integer Number, for one, and integer numbers can’t safely go above 2**53 - but i suspect in this case it’s due to legacy reasons, and i think the arg limit is closer to 2**31?
I can’t find a specific place in the spec atm where there’s a limit mentioned, however - hopefully i just missed it and someone can chime in :-)
I don’t think that ES imposes, or even recognises, any limit on memory usage, string length, call stack size, number of arguments in function call, etc., except for the 253 value for some integer-indexed structures and the hysterical value of 231 for Arrays.
However, real-world implementations typically impose such limits. Here is an example that will throw a RangeError in mainstream engines, even if 1e6 is much smaller than 231: