-
-
Notifications
You must be signed in to change notification settings - Fork 580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Max array length constant doesn't seem to match actual limits in browsers #1178
Comments
Allocating a large array also fails since the buffer cannot be allocated.
|
@domoritz Thanks for filing this issue. The
Now, whether browser engines actually support arrays of up to And, FWIW, I don't know if we can reliably ascertain a universal max typed array length, as this is likely to be engine/platform-specific.
When I run this from the
To help me understand a bit better your use case, what was the situation you faced where you are trying to allocate large arrays, including up to |
For dynamically resolving the max practical typed array length, we could add a utility to |
I came across this as I am adding support for LargeUTF8 to Arrow in apache/arrow#35780. In these string vectors, we have one buffer for offsets and one for data. The offset buffer is a BigUint64Array and so offsets can be larger than the I guess I don't really understand the purpose of that package when it's not actually the limit any engine supports and also way too large for any reasonable use case. It feels like using this constant from the package would never be useful since limits would be hit much earlier. |
@domoritz The package (and associated value) is used for testing (a) whether something is a valid typed-array-like object and (b) whether a value is a valid typed array index. We do the same for checking for array-like objects, but there the limit is the max Int32. While the limit for typed arrays will never be hit in practice, at least according to the spec, it is allowed, and so when we check whether something is a more general collection, we are obligated to honor the spec. E.g., implementing a sparse array having length |
I see. For testing makes sense. Do you have plans for implementing an array type that is larger than the current implementation-defined limits? I'll close the issue since there isn't a big issue here. |
@domoritz No immediate plans, but also not opposed. I've toyed a bit with extending stdlib |
Description
Encountered an error when I tried to allocate a large array with the size in https://github.com/stdlib-js/constants-array-max-typed-array-length.
Doesn't work in any browser (Firefox, Safari, Chrome) or Node.
Environments
Node.js, Firefox, Chrome, Safari
The text was updated successfully, but these errors were encountered: