-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
JRuby 1.7: ArgumentError: argument too big in RubyString #3243
Comments
I was going to change int as index to long as index in RubyString but I realize that we will run into platform issues (which is likely why this was originally capped at MAX_INT). Without significant changes to how RubyString is defined (like using ropes/multiple lists internally) this will not get solved easily. I am leaving this open as I think we can solve this but I do not anticipate us fixing this near term. |
Is there another way to generate a massive string you'd recommend in the interim? |
@mjc Perhaps make a string-like class which aggregates a list of strings. This may not sound appealing but it does have a useful property: Not all memory needs to be contiguously allocated. Finding a single contiguous region of 10G of memory is potentially challenging but 10 1G segments much less so. |
@mjc out of curiosity, have you tried creating very large strings in MRI as well? I wonder if we're behaving appropriately here |
Yes, this works fine in MRI, as big a string as memory and swap allow. On Mon, Aug 17, 2015 at 10:57 AM, R. Tyler Croy notifications@github.com
|
@rtyler MRI is long so they may work or likely work for larger than max int |
It's not possible for us to represent a large string like this with standard JVM code, since a byte[] in Java can only be indexed by a 32-bit signed integer. It would be possible to do this if we had a ByteList that used tricks like Unsafe, but that's a really big leap to make. |
If we make aggregate bytelist with @nirvdrum bytelist extension changes we can support it through that but then we would need long signatures on bytelist (jotting notes here) |
Tried to generate a 10GB string in Ruby 1.7.20 and it looks like the number is too big for RubyString?
MRI successfully generates this string. JRuby 9k does the same thing as 1.7.
The text was updated successfully, but these errors were encountered: