{"action":"created","issue":{"url":"https://api.github.com/repos/mjambon/atd/issues/103","repository_url":"https://api.github.com/repos/mjambon/atd","labels_url":"https://api.github.com/repos/mjambon/atd/issues/103/labels{/name}","comments_url":"https://api.github.com/repos/mjambon/atd/issues/103/comments","events_url":"https://api.github.com/repos/mjambon/atd/issues/103/events","html_url":"https://github.com/mjambon/atd/issues/103","id":326779958,"number":103,"title":"atdgen cannot print large json files on 32bit architectures","user":{"login":"mjambon","id":343265,"avatar_url":"https://avatars3.githubusercontent.com/u/343265?v=4","gravatar_id":"","url":"https://api.github.com/users/mjambon","html_url":"https://github.com/mjambon","followers_url":"https://api.github.com/users/mjambon/followers","following_url":"https://api.github.com/users/mjambon/following{/other_user}","gists_url":"https://api.github.com/users/mjambon/gists{/gist_id}","starred_url":"https://api.github.com/users/mjambon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjambon/subscriptions","organizations_url":"https://api.github.com/users/mjambon/orgs","repos_url":"https://api.github.com/users/mjambon/repos","events_url":"https://api.github.com/users/mjambon/events{/privacy}","received_events_url":"https://api.github.com/users/mjambon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-05-27T01:36:14Z","updated_at":"2018-05-27T01:36:16Z","closed_at":null,"author_association":"OWNER","body":"_From @josch on March 20, 2015 11:11_\n\nHi,\n\nwhen running my code on 32bit architectures, then for big output I'm getting the following traceback:\n\n```\nFatal error: exception Failure(\"oops\")\nRaised at file \"pervasives.ml\", line 20, characters 22-33\nCalled from file \"write.ml\", line 52, characters 2-24\nCalled from file \"datatypes_j.ml\", line 52, characters 4-47\nCalled from file \"ag_oj_run.ml\", line 19, characters 1-6\nCalled from file \"ag_oj_run.ml\", line 43, characters 2-39\nCalled from file \"ag_oj_run.ml\", line 19, characters 1-6\nCalled from file \"ag_oj_run.ml\", line 43, characters 2-39\nCalled from file \"ag_oj_run.ml\", line 19, characters 1-6\nCalled from file \"ag_oj_run.ml\", line 43, characters 2-39\nCalled from file \"ag_oj_run.ml\", line 25, characters 1-6\nCalled from file \"ag_oj_run.ml\", line 43, characters 2-39\nCalled from file \"datatypes_j.ml\", line 2324, characters 4-62\nCalled from file \"datatypes_j.ml\", line 2332, characters 2-18\n```\n\nI am running Debian unstable and have the following versions installed:\n- libatdgen-ocaml-dev 1.3.1-1+b1\n- libyojson-ocaml-dev 1.1.8-1\n- libbiniou-ocaml-dev 1.0.9-1\n\nI 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.\n\nI'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?\n\n\n_Copied from original issue: mjambon/atdgen#29_"},"comment":{"url":"https://api.github.com/repos/mjambon/atd/issues/comments/392299069","html_url":"https://github.com/mjambon/atd/issues/103#issuecomment-392299069","issue_url":"https://api.github.com/repos/mjambon/atd/issues/103","id":392299069,"user":{"login":"mjambon","id":343265,"avatar_url":"https://avatars3.githubusercontent.com/u/343265?v=4","gravatar_id":"","url":"https://api.github.com/users/mjambon","html_url":"https://github.com/mjambon","followers_url":"https://api.github.com/users/mjambon/followers","following_url":"https://api.github.com/users/mjambon/following{/other_user}","gists_url":"https://api.github.com/users/mjambon/gists{/gist_id}","starred_url":"https://api.github.com/users/mjambon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjambon/subscriptions","organizations_url":"https://api.github.com/users/mjambon/orgs","repos_url":"https://api.github.com/users/mjambon/repos","events_url":"https://api.github.com/users/mjambon/events{/privacy}","received_events_url":"https://api.github.com/users/mjambon/received_events","type":"User","site_admin":false},"created_at":"2018-05-27T01:36:16Z","updated_at":"2018-05-27T01:36:16Z","author_association":"OWNER","body":"_From @josch on March 20, 2015 23:32_\n\nTo clarify the problem, let me give you a minimal example.\n- `Makefile`:\n\n```\ntest.native: datatypes_j.ml datatypes_t.ml test.ml\n    ocamlbuild -classic-display -use-ocamlfind -package atdgen test.native\n\n%_j.ml: %.atd\n    atdgen -j -j-std $<\n\n%_t.ml: %.atd\n    atdgen -t $<\n\n.PHONY: clean\nclean:\n    rm -f datatypes_j.ml datatypes_j.mli datatypes.ml datatypes.mli datatypes_t.ml datatypes_t.mli test.native\n    rm -rf _build\n```\n- `test.ml`\n\n```\nlet main () =\n  let s = String.make (int_of_string Sys.argv.(1)) 'c' in\n  print_endline (Datatypes_j.string_of_output (s, s));\n;;\n\nmain ();;\n```\n- `datatypes.atd`\n\n```\ntype output = (string * string)\n```\n\nCompile the whole thing by running `make` and then execute:\n\n```\n$ ./test.native 8388602\n```\n\nThis will work fine. But then:\n\n```\n$ ./test.native 8388603\nFatal error: exception Invalid_argument(\"Buf.extend: reached Sys.max_string_length\")\n```\n\nNice readable error message. The problem starts here:\n\n```\n$ ./test.native 8388604\n[lots of output]\nFatal error: exception Failure(\"oops\")\n```\n\nThis error message is not really helpful and it would be great if this would not happen on 32 bits.\n\nAnother 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.\n"}}
{"actor":{"display_login":"mjambon"}}