-
Notifications
You must be signed in to change notification settings - Fork 59
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
atdgen cannot print large json files on 32bit architectures #56
Comments
What are the values for It's probably a size limit problem; it's possible that your string cannot be added to the buffer, which itself is a string. The maximum length on any given string is 16MB on 32-bit platforms. Usual workarounds include using a 64-bit platform, breaking large data into chunks (using a wrapper, see http://stackoverflow.com/a/28997459/597517), or not using json for large data but a streaming protocol of some kind (which breaks the data into chunks for you). |
From @josch on March 20, 2015 18:46 Hi, Could you make it such that this information ends up as part of the raised exception? Just being told In my case, that message had Do you deem this to be worth fixing by using a different data structure than a string for the buffer? Breaking the input data into chunks will be an ugly workaround because it is hard to impossible to predict how much space a given piece of input data will take when converted into json before doing the actual conversion. Using a 64-bit platform could be a workaround but so would using a datastructure as a buffer which is not an ocaml string. Then every platform could work with large data. |
I'm not sure what the problem is, it could be a bug in yojson. I'll take a look a bit later. |
From @josch on March 20, 2015 23:32 To clarify the problem, let me give you a minimal example.
Compile the whole thing by running
This will work fine. But then:
Nice readable error message. The problem starts here:
This error message is not really helpful and it would be great if this would not happen on 32 bits. Another solution to the problem could be to not buffer the result in the first place but to allow passing an output channel to which any generated json would then directly be written to. |
Proposed resolution: include all useful information in the exception and don't print anything to stderr. |
From @mjambon on May 27, 2018 1:36
From @josch on March 20, 2015 11:11
Hi,
when running my code on 32bit architectures, then for big output I'm getting the following traceback:
I am running Debian unstable and have the following versions installed:
I was told in the #debian-ocaml IRC channel that this problem might be caused by 32bit architectures not supporting very large strings (>= 8MB) and I observe the problem for instances that would create a 53MB json file on a 64bit platform.
I'm also unsure where exactly the problem should be fixed. Maybe this is actually a biniou problem as that library uses a mutable string as a buffer internally?
Copied from original issue: mjambon/atdgen#29
Copied from original issue: ahrefs/atd#103
The text was updated successfully, but these errors were encountered: