-
Notifications
You must be signed in to change notification settings - Fork 42
Allow parsing strings larger than 2GiB #147
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
Conversation
test/strscan/test_stringscanner.rb
Outdated
| def test_large_string | ||
| six_gib = (6 * 1024 * 1024 * 1024) | ||
| string = "a" * six_gib | ||
| s = create_string_scanner(string) # 6 GiB string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that we need at least 6 GiB memory to run this test...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. I don't know how to test it otherwise. I could reduce the size to a bit more than 4GiB, or even 2GiB given it's signed.
We could also just not test it, but this revealed that the Java version has the same limitation, so I think it was valuable. (I won't update the JRuby version though, because there everything uses an int so it's way to much work for me. cc @headius)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up removing the test, as it also doesn't work on windows, nor on 32bit systems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
e54d2f7 to
e6b8698
Compare
ad278f2 to
58505f7
Compare
For a reason unknown, even though `pos` is stored as a `long`, the `#pos` and `#pos=` treat it as an `int`, which prevent skeeing into strings larger than 2GiB.
(ruby/strscan#147) For a reason unknown, even though `pos` is stored as a `long`, the `#pos` and `#pos=` treat it as an `int`, which prevent seeking into strings larger than 2GiB. ruby/strscan@b76368416e Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
For a reason unknown, even though
posis stored as along, the#posand#pos=treat it as anint, which prevent seeking into strings larger than 2GiB.cc @kou