Skip to content
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

stri_encode: maximal supported size of a single string is ~0.67 GB #395

Open
gagolews opened this issue Aug 21, 2020 · 1 comment
Open

Comments

@gagolews
Copy link
Owner

To support the full 2^31-1 (*) bytes per string, the stri_encode would need to be rewritten using batch uconv processing.

(*) R Internals:

Elements of character vectors (CHARSXPs) remain limited to 2^31 - 1 bytes.

> library(stringi); x<-stri_dup("a", 2**30); y <- paste(c(x, x), collapse="")
#Error in paste(c(x, x), collapse = "") : result would exceed 2^31-1 bytes
@gagolews
Copy link
Owner Author

Some code to play with:

Rscript -e '
x <- charToRaw(stringi::stri_dup("a", 2**30))
print(length(x))
print(length(x)/1024/1024)
y <- stringi::stri_encode(x, NULL, "utf-8")
stopifnot(identical(rawToChar(x), y))
'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant