{"action":"created","comment":{"url":"https://api.github.com/repos/ocaml/ocaml/pulls/comments/97745721","pull_request_review_id":18363636,"id":97745721,"diff_hunk":"@@ -241,6 +250,9 @@ Next version (4.05.0):\n - GPR#881: change `Outcometree.out_variant` to be more general.\n   `Ovar_name of out_ident * out_type list` becomes `Ovar_type of out_type`.\n   (Valentin Gatien-Baron)\n+=======\n+  (Alain Frisch, report by Daniel Bünzli, review by Jérémie Dimino)\n+>>>>>>> Added an entry to Changes","path":"Changes","position":29,"original_position":29,"commit_id":"e79039fa3235d2b772c3f46c9be59253df3897de","original_commit_id":"e79039fa3235d2b772c3f46c9be59253df3897de","user":{"login":"dra27","id":5250680,"avatar_url":"https://avatars.githubusercontent.com/u/5250680?v=3","gravatar_id":"","url":"https://api.github.com/users/dra27","html_url":"https://github.com/dra27","followers_url":"https://api.github.com/users/dra27/followers","following_url":"https://api.github.com/users/dra27/following{/other_user}","gists_url":"https://api.github.com/users/dra27/gists{/gist_id}","starred_url":"https://api.github.com/users/dra27/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dra27/subscriptions","organizations_url":"https://api.github.com/users/dra27/orgs","repos_url":"https://api.github.com/users/dra27/repos","events_url":"https://api.github.com/users/dra27/events{/privacy}","received_events_url":"https://api.github.com/users/dra27/received_events","type":"User","site_admin":false},"body":"As does this!","created_at":"2017-01-25T10:10:20Z","updated_at":"2017-01-25T10:10:20Z","html_url":"https://github.com/ocaml/ocaml/pull/71#discussion_r97745721","pull_request_url":"https://api.github.com/repos/ocaml/ocaml/pulls/71","_links":{"self":{"href":"https://api.github.com/repos/ocaml/ocaml/pulls/comments/97745721"},"html":{"href":"https://github.com/ocaml/ocaml/pull/71#discussion_r97745721"},"pull_request":{"href":"https://api.github.com/repos/ocaml/ocaml/pulls/71"}}},"pull_request":{"url":"https://api.github.com/repos/ocaml/ocaml/pulls/71","id":17048720,"html_url":"https://github.com/ocaml/ocaml/pull/71","diff_url":"https://github.com/ocaml/ocaml/pull/71.diff","patch_url":"https://github.com/ocaml/ocaml/pull/71.patch","issue_url":"https://api.github.com/repos/ocaml/ocaml/issues/71","number":71,"state":"open","locked":false,"title":"The unloadable runtime proposal","user":{"login":"cakeplus","id":2566940,"avatar_url":"https://avatars.githubusercontent.com/u/2566940?v=3","gravatar_id":"","url":"https://api.github.com/users/cakeplus","html_url":"https://github.com/cakeplus","followers_url":"https://api.github.com/users/cakeplus/followers","following_url":"https://api.github.com/users/cakeplus/following{/other_user}","gists_url":"https://api.github.com/users/cakeplus/gists{/gist_id}","starred_url":"https://api.github.com/users/cakeplus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cakeplus/subscriptions","organizations_url":"https://api.github.com/users/cakeplus/orgs","repos_url":"https://api.github.com/users/cakeplus/repos","events_url":"https://api.github.com/users/cakeplus/events{/privacy}","received_events_url":"https://api.github.com/users/cakeplus/received_events","type":"User","site_admin":false},"body":"## Problem description\n\nCurrently (as of the latest trunk revision) the runtime cannot be unloaded in a clean way — that is, without leaking resources. Once `caml_startup` is called, and during the program execution, the runtime performs allocations using the `malloc` implementation provided by the C runtime. Allocated with `malloc` are: the stack, the heap sections, code fragments, custom operations, various buffers and tables, none of which is freed explicitly by the runtime.\n\nIf the OCaml program is compiled into a standalone executable, then nothing is wrong with those allocations, since the operating system will handle the cleanup once the process exits. However, in case when the program is compiled as a shared library, which is to be loaded and unloaded by a foreign application (e.g. written in C++), unloading the library results in memory leaks. Moreover, heap values are not finalised, and the dependent shared libraries (those loaded by Dynlink) are never freed.\n\nIn my particular case, the shared library (an OCaml program combined with the runtime) is loaded and unloaded repeatedly by a proprietary software system written in Delphi, which knows nothing about OCaml, but which exposes a plugin API, and which expects each plugin to be responsible for cleaning up its resources on unloading. Given that the OCaml's runtime does not support unloading properly, each such \"unloading\" results in a several-megabyte memory leak, as well as the leakage of all the dependent DLLs' handles, thus disallowing to hot-swap the libraries without restarting the process (on Windows).\n\nIn contrast, no such problems arise with the nice and friendly runtime of the Glasgow Haskell Compiler. Its glorious [API](http://www.haskell.org/ghc/docs/latest/html/users_guide/ffi-ghc.html#using-own-main) provides not only the `hs_init` function (a counterpart to `caml_startup`), but also `hs_exit`, which can be used to shut down the runtime properly. There can be multiple calls to `hs_init`, and each can be matched with an independent call to `hs_exit`. Lovely! So, if your business requirements involve cleanly unloading a shared library, then OCaml eats dust, while Haskell delivers. Shame on us!\n\nIt is thus proposed to add a similar facility to OCaml, by implementing the `caml_shutdown` function.\n\nThe proposal is possibly related to [#PR385](http://caml.inria.fr/mantis/view.php?id=385), which is reported in French and is 13 years old. [Googling](https://www.google.ru/search?q=caml_cleanup) for `caml_cleanup` reveals that other people have previously expressed interest in such a facility, which means it's not only a personal whim of the proposal's author, but something that can make OCaml more useful to a considerable number of users.\n## Proposed solution\n\nAttached to the proposal is a working implementation of the author's vision of how should an unloadable runtime be implemented. Implementation details follow.\n### Dealing with allocations in the C heap\n\nIn order to avoid memory leaks, each outstanding call to `malloc` must be paired with a corresponding call to `free` on shutdown. An ugly way to solve the problem involves locating all points of unresolved allocation inside the runtime's source code, figuring out how to free the memory correctly in each particular case, meticulously writing a lot of stupid boilerplate code, and eventually polluting the namespace with numerous \"cleanup\" functions — not nice at all.\n\nA proper way involves using a memory manager.\n\nInstead of allocating memory directly in the C heap, we can maintain a memory pool, enabling us to easily free all the heap-allocated memory once we've decided to shut the runtime down. If we only cared about supporting Windows, then we could use [HeapCreate](http://msdn.microsoft.com/en-us/library/windows/desktop/aa366599%28v=vs.85%29.aspx) and associated machinery. Unfortunately, there is no standard alternative to HeapCreate on Unix, so, for maximum portability, the best solution would be to bundle a simple memory manager with the runtime itself.\n\nIn the proposed implementation, the memory management layer is built on top of [Halloc](http://swapped.cc/halloc), which is a thin wrapper around `malloc` and `free` that allows to specify dependencies between memory blocks, by storing additional information inside each block's header.\n\nThankfully, most operations with the C heap are already wrapped in `caml_stat_*` functions, so it was no big deal to change the implementation. Someplace in the runtime, there were direct calls to `malloc`, `calloc`, `realloc`, `strdup` and `free`, which had to be replaced with calls to `caml_stat_*`. The `caml_stat_*_noexc` functions were added for compatibility with `malloc` and friends, which never throw an OCaml exception. Perhaps we should get rid of the exceptions altogether in such situations (allocation errors) and simply kill the process with `caml_fatal_error`? This is [how it's done](https://github.com/ghc/ghc/blob/master/rts/RtsUtils.c) in GHC, and I don't see a problem with this approach.\n\nMaintaining the pool comes at a price:\n1) Each block's header takes 3 machine words of additional space.\n2) Allocations and deallocations suffer a constant time overhead, which should be absolutely negligible, given that `malloc` and `free` operations typically constitute only a marginal bit of the runtime's lifetime (an educated guess).\n3) Care must be taken to ensure that each block allocated with `caml_stat_alloc` is further operated on using only the `caml_stat_*` functions, otherwise we're asking for segfaults and memory corruption, since \"normal\" blocks do not start with a header.\n\nI certainly could simplify Halloc, by making it support only flat, non-hierarchical pools. As a result, the block header would only take 2 words, and bookkeeping would become a bit faster. However, hierarchical memory pool may come handy with the [reentrant runtime](https://github.com/lucasaiu/ocaml), which (AFAIK) doesn't support freeing the thread-local storage yet. For instance, there could be one global pool as well as several dependent thread-local pools. There already is the [extensible buffer](https://github.com/lucasaiu/ocaml/blob/master/byterun/extensible_buffer.h) data structure in the reentrant runtime, the planned purpose of which, I suppose, is to be used for implementing thread-local storage. However, it is just a bump allocator, which is terrific for performance and horrific for flexibility. It doesn't allow freeing the blocks in arbitrary order, and I don't see how could it be used to store all that stuff that is being allocated with `malloc` right now.\n### Finalising the `Custom` blocks\n\n`caml_finalise_heap` handles finalisation of `Custom`-tagged heap values. The algorithm:\n1) Let all heap values become White (by finishing the major cycle).\n2) Forcibly sweep the heap, disregarding both local and global roots. Eventually, all `Custom` values are finalised.\n\nWe don't need to worry about `Custom` block finalisers disrupting the state of the GC or allocating new values, [because they simply can't](http://caml.inria.fr/pub/docs/manual-ocaml/intfc.html#sec449).\n### Handling Gc.finalise\n\nNot only `Custom` blocks need to be finalised, but also those values that have associated finalisers registered with the `Gc.finalise` facility. Handling those values is tricky, because their finalisers are implemented in OCaml, and may themselves allocate finalisable values. In fact, it makes the problem fundamentally unsolvable.\n\nWhat we _can_ do, however, is to use a heuristic solution which would work well enough in typical cases. For instance, we can simply ignore those values that are allocated by finalisers (and make it a documented behavior of `caml_shutdown`). `caml_final_do_all_calls` implements such a solution, by moving all values from the finalisable set into the finalising set, then triggering a single wave of finalisations (in the correct order, according to the documented semantics of `Gc.finalise`).\n\nA question to those fluent in the runtime internals: why does `caml_final_update` unroll `Forward` values? If a lazy value is passed to a finaliser, wouldn't then the unrolling be handled by an explicit call to Lazy.force, inside the finaliser itself?\n### Unloading shared libraries\n\nIf a bytecode module statically depends on a set shared libraries (specified in the `DLL` section of the compiled module), then the runtime loads those libraries on startup and stores their handles in a global table. Those libraries must be unloaded explicitly, which is what the new `caml_free_shared_libs` function does.\n\nA strange thing: on Unix (and Unix only), `caml_dlopen` uses the `RTLD_NODELETE` flag, which disables unloading completely, leading to unavoidable leaks. The flag was added 12 years ago by Jacques Garrigue as part of a [huge commit](https://github.com/ocaml/ocaml/commit/0a8236066f945c6026337dd4ea9342a9034f7987), which, apart from adding that flag, doesn't seem to be anyhow related to handling shared libraries.\n\nThe flag is removed in my patch, because I couldn't make any sense of it.\n### Wrapping it all up\n\nNow that all stages of runtime shutdown are implemented, it's time to figure out the correct order of running them:\n- Obviously, `caml_stat_destroy_pool` is the most destructive stage. Once it is triggered, the runtime becomes full of dangling pointers. Therefore, this stage must come _last_ in `caml_shutdown`.\n- `caml_final_do_all_calls` triggers OCaml-implemented finalisers; thus it depends on both heap values and loaded shared libraries. It must come _first_.\n- `caml_finalise_heap` triggers C-implemented finalisers. Those finalisers may depend on availability of shared libraries. It means that `caml_free_shared_libs` must come strictly _after_ the heap finalisation.\n## Demonstration\n\nThe [provided set of test programs](https://github.com/cakeplus/caml_shutdown_testcase) can be used, in conjunction with memory debugging tools like Valgrind (on Unix) and DrMemory (on Windows), to demonstrate plausibility of the provided implementation of `caml_shutdown`.\n\nAvailable `make` targets:\n- `leak_test` and `leak_test.opt` build a C application that starts the embedded OCaml runtime, calls a function from the embedded OCaml module, then shuts the runtime down.\n- `leak_test_loop` compiles an OCaml program into a shared library using `ocamlc -output-obj`. It also builds a C application that simulates loading and unloading the library dynamically, in an endless loop, calling a function from the embedded OCaml module on each iteration.\n\nPerforming a test on one of my real world applications revealed a suspicious leak:\n\n```\nmrm@counterfeit-monkey:~/projects/_MY/_GEOTEC/fitsolve$ valgrind --leak-check=full --show-reachable=yes fitsolve -f porosity.pr\n==15302== Memcheck, a memory error detector\n==15302== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.\n==15302== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info\n==15302== Command: /usr/bin/primec -f halim2.pr\n==15302==\n==15302==\n==15302== HEAP SUMMARY:\n==15302==     in use at exit: 32 bytes in 1 blocks\n==15302==   total heap usage: 550 allocs, 549 frees, 9,400,464 bytes allocated\n==15302==\n==15302== 32 bytes in 1 blocks are still reachable in loss record 1 of 1\n==15302==    at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)\n==15302==    by 0x512F59F: _dlerror_run (dlerror.c:142)\n==15302==    by 0x512EFC0: dlopen@@GLIBC_2.2.5 (dlopen.c:88)\n==15302==    by 0x41D231: caml_dlopen (in /home/mrm/.opam/4.03.0local+git-caml_shutdown/bin/ocamlrun)\n==15302==    by 0x41C68F: caml_build_primitive_table (in /home/mrm/.opam/4.03.0local+git-caml_shutdown/bin/ocamlrun)\n==15302==    by 0x4206E5: caml_main (in /home/mrm/.opam/4.03.0local+git-caml_shutdown/bin/ocamlrun)\n==15302==    by 0x41D363: main (in /home/mrm/.opam/4.03.0local+git-caml_shutdown/bin/ocamlrun)\n==15302==\n==15302== LEAK SUMMARY:\n==15302==    definitely lost: 0 bytes in 0 blocks\n==15302==    indirectly lost: 0 bytes in 0 blocks\n==15302==      possibly lost: 0 bytes in 0 blocks\n==15302==    still reachable: 32 bytes in 1 blocks\n==15302==         suppressed: 0 bytes in 0 blocks\n==15302==\n==15302== For counts of detected and suppressed errors, rerun with: -v\n==15302== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 3 from 3)\n```\n\nMost likely it is a bug either in Glibc or Valgrind itself. I couldn't figure it out. The leak is not cumulative: it doesn't matter if I modify `dynlink.c` so that it load/unloads the same library multiple times instead of doing it once — the \"leak\" stays constant, so I suggest we simply ignore it.\n","created_at":"2014-06-12T10:59:37Z","updated_at":"2017-01-25T10:10:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b5525482d0ea1541e0319cbe37429468317fb6be","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ocaml/ocaml/pulls/71/commits","review_comments_url":"https://api.github.com/repos/ocaml/ocaml/pulls/71/comments","review_comment_url":"https://api.github.com/repos/ocaml/ocaml/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ocaml/ocaml/issues/71/comments","statuses_url":"https://api.github.com/repos/ocaml/ocaml/statuses/e79039fa3235d2b772c3f46c9be59253df3897de","head":{"label":"cakeplus:caml_shutdown","ref":"caml_shutdown","sha":"e79039fa3235d2b772c3f46c9be59253df3897de","user":{"login":"cakeplus","id":2566940,"avatar_url":"https://avatars.githubusercontent.com/u/2566940?v=3","gravatar_id":"","url":"https://api.github.com/users/cakeplus","html_url":"https://github.com/cakeplus","followers_url":"https://api.github.com/users/cakeplus/followers","following_url":"https://api.github.com/users/cakeplus/following{/other_user}","gists_url":"https://api.github.com/users/cakeplus/gists{/gist_id}","starred_url":"https://api.github.com/users/cakeplus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cakeplus/subscriptions","organizations_url":"https://api.github.com/users/cakeplus/orgs","repos_url":"https://api.github.com/users/cakeplus/repos","events_url":"https://api.github.com/users/cakeplus/events{/privacy}","received_events_url":"https://api.github.com/users/cakeplus/received_events","type":"User","site_admin":false},"repo":{"id":20307206,"name":"ocaml","full_name":"cakeplus/ocaml","owner":{"login":"cakeplus","id":2566940,"avatar_url":"https://avatars.githubusercontent.com/u/2566940?v=3","gravatar_id":"","url":"https://api.github.com/users/cakeplus","html_url":"https://github.com/cakeplus","followers_url":"https://api.github.com/users/cakeplus/followers","following_url":"https://api.github.com/users/cakeplus/following{/other_user}","gists_url":"https://api.github.com/users/cakeplus/gists{/gist_id}","starred_url":"https://api.github.com/users/cakeplus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cakeplus/subscriptions","organizations_url":"https://api.github.com/users/cakeplus/orgs","repos_url":"https://api.github.com/users/cakeplus/repos","events_url":"https://api.github.com/users/cakeplus/events{/privacy}","received_events_url":"https://api.github.com/users/cakeplus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cakeplus/ocaml","description":"Read-only mirror of INRIA SVN","fork":true,"url":"https://api.github.com/repos/cakeplus/ocaml","forks_url":"https://api.github.com/repos/cakeplus/ocaml/forks","keys_url":"https://api.github.com/repos/cakeplus/ocaml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cakeplus/ocaml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cakeplus/ocaml/teams","hooks_url":"https://api.github.com/repos/cakeplus/ocaml/hooks","issue_events_url":"https://api.github.com/repos/cakeplus/ocaml/issues/events{/number}","events_url":"https://api.github.com/repos/cakeplus/ocaml/events","assignees_url":"https://api.github.com/repos/cakeplus/ocaml/assignees{/user}","branches_url":"https://api.github.com/repos/cakeplus/ocaml/branches{/branch}","tags_url":"https://api.github.com/repos/cakeplus/ocaml/tags","blobs_url":"https://api.github.com/repos/cakeplus/ocaml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cakeplus/ocaml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cakeplus/ocaml/git/refs{/sha}","trees_url":"https://api.github.com/repos/cakeplus/ocaml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cakeplus/ocaml/statuses/{sha}","languages_url":"https://api.github.com/repos/cakeplus/ocaml/languages","stargazers_url":"https://api.github.com/repos/cakeplus/ocaml/stargazers","contributors_url":"https://api.github.com/repos/cakeplus/ocaml/contributors","subscribers_url":"https://api.github.com/repos/cakeplus/ocaml/subscribers","subscription_url":"https://api.github.com/repos/cakeplus/ocaml/subscription","commits_url":"https://api.github.com/repos/cakeplus/ocaml/commits{/sha}","git_commits_url":"https://api.github.com/repos/cakeplus/ocaml/git/commits{/sha}","comments_url":"https://api.github.com/repos/cakeplus/ocaml/comments{/number}","issue_comment_url":"https://api.github.com/repos/cakeplus/ocaml/issues/comments{/number}","contents_url":"https://api.github.com/repos/cakeplus/ocaml/contents/{+path}","compare_url":"https://api.github.com/repos/cakeplus/ocaml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cakeplus/ocaml/merges","archive_url":"https://api.github.com/repos/cakeplus/ocaml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cakeplus/ocaml/downloads","issues_url":"https://api.github.com/repos/cakeplus/ocaml/issues{/number}","pulls_url":"https://api.github.com/repos/cakeplus/ocaml/pulls{/number}","milestones_url":"https://api.github.com/repos/cakeplus/ocaml/milestones{/number}","notifications_url":"https://api.github.com/repos/cakeplus/ocaml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cakeplus/ocaml/labels{/name}","releases_url":"https://api.github.com/repos/cakeplus/ocaml/releases{/id}","deployments_url":"https://api.github.com/repos/cakeplus/ocaml/deployments","created_at":"2014-05-29T20:19:48Z","updated_at":"2014-06-13T05:48:33Z","pushed_at":"2017-01-23T21:25:47Z","git_url":"git://github.com/cakeplus/ocaml.git","ssh_url":"git@github.com:cakeplus/ocaml.git","clone_url":"https://github.com/cakeplus/ocaml.git","svn_url":"https://github.com/cakeplus/ocaml","homepage":null,"size":151818,"stargazers_count":0,"watchers_count":0,"language":"OCaml","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"trunk"}},"base":{"label":"ocaml:trunk","ref":"trunk","sha":"8ab0ac03000e8dd8261521b385862a41775578a4","user":{"login":"ocaml","id":1841483,"avatar_url":"https://avatars.githubusercontent.com/u/1841483?v=3","gravatar_id":"","url":"https://api.github.com/users/ocaml","html_url":"https://github.com/ocaml","followers_url":"https://api.github.com/users/ocaml/followers","following_url":"https://api.github.com/users/ocaml/following{/other_user}","gists_url":"https://api.github.com/users/ocaml/gists{/gist_id}","starred_url":"https://api.github.com/users/ocaml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocaml/subscriptions","organizations_url":"https://api.github.com/users/ocaml/orgs","repos_url":"https://api.github.com/users/ocaml/repos","events_url":"https://api.github.com/users/ocaml/events{/privacy}","received_events_url":"https://api.github.com/users/ocaml/received_events","type":"Organization","site_admin":false},"repo":{"id":6786166,"name":"ocaml","full_name":"ocaml/ocaml","owner":{"login":"ocaml","id":1841483,"avatar_url":"https://avatars.githubusercontent.com/u/1841483?v=3","gravatar_id":"","url":"https://api.github.com/users/ocaml","html_url":"https://github.com/ocaml","followers_url":"https://api.github.com/users/ocaml/followers","following_url":"https://api.github.com/users/ocaml/following{/other_user}","gists_url":"https://api.github.com/users/ocaml/gists{/gist_id}","starred_url":"https://api.github.com/users/ocaml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocaml/subscriptions","organizations_url":"https://api.github.com/users/ocaml/orgs","repos_url":"https://api.github.com/users/ocaml/repos","events_url":"https://api.github.com/users/ocaml/events{/privacy}","received_events_url":"https://api.github.com/users/ocaml/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ocaml/ocaml","description":"The core OCaml system: compilers, runtime system, base libraries","fork":false,"url":"https://api.github.com/repos/ocaml/ocaml","forks_url":"https://api.github.com/repos/ocaml/ocaml/forks","keys_url":"https://api.github.com/repos/ocaml/ocaml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ocaml/ocaml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ocaml/ocaml/teams","hooks_url":"https://api.github.com/repos/ocaml/ocaml/hooks","issue_events_url":"https://api.github.com/repos/ocaml/ocaml/issues/events{/number}","events_url":"https://api.github.com/repos/ocaml/ocaml/events","assignees_url":"https://api.github.com/repos/ocaml/ocaml/assignees{/user}","branches_url":"https://api.github.com/repos/ocaml/ocaml/branches{/branch}","tags_url":"https://api.github.com/repos/ocaml/ocaml/tags","blobs_url":"https://api.github.com/repos/ocaml/ocaml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ocaml/ocaml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ocaml/ocaml/git/refs{/sha}","trees_url":"https://api.github.com/repos/ocaml/ocaml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ocaml/ocaml/statuses/{sha}","languages_url":"https://api.github.com/repos/ocaml/ocaml/languages","stargazers_url":"https://api.github.com/repos/ocaml/ocaml/stargazers","contributors_url":"https://api.github.com/repos/ocaml/ocaml/contributors","subscribers_url":"https://api.github.com/repos/ocaml/ocaml/subscribers","subscription_url":"https://api.github.com/repos/ocaml/ocaml/subscription","commits_url":"https://api.github.com/repos/ocaml/ocaml/commits{/sha}","git_commits_url":"https://api.github.com/repos/ocaml/ocaml/git/commits{/sha}","comments_url":"https://api.github.com/repos/ocaml/ocaml/comments{/number}","issue_comment_url":"https://api.github.com/repos/ocaml/ocaml/issues/comments{/number}","contents_url":"https://api.github.com/repos/ocaml/ocaml/contents/{+path}","compare_url":"https://api.github.com/repos/ocaml/ocaml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ocaml/ocaml/merges","archive_url":"https://api.github.com/repos/ocaml/ocaml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ocaml/ocaml/downloads","issues_url":"https://api.github.com/repos/ocaml/ocaml/issues{/number}","pulls_url":"https://api.github.com/repos/ocaml/ocaml/pulls{/number}","milestones_url":"https://api.github.com/repos/ocaml/ocaml/milestones{/number}","notifications_url":"https://api.github.com/repos/ocaml/ocaml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ocaml/ocaml/labels{/name}","releases_url":"https://api.github.com/repos/ocaml/ocaml/releases{/id}","deployments_url":"https://api.github.com/repos/ocaml/ocaml/deployments","created_at":"2012-11-20T22:18:22Z","updated_at":"2017-01-24T15:24:26Z","pushed_at":"2017-01-24T21:13:49Z","git_url":"git://github.com/ocaml/ocaml.git","ssh_url":"git@github.com:ocaml/ocaml.git","clone_url":"https://github.com/ocaml/ocaml.git","svn_url":"https://github.com/ocaml/ocaml","homepage":"","size":143013,"stargazers_count":1121,"watchers_count":1121,"language":"OCaml","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":323,"mirror_url":null,"open_issues_count":154,"forks":323,"open_issues":154,"watchers":1121,"default_branch":"trunk"}},"_links":{"self":{"href":"https://api.github.com/repos/ocaml/ocaml/pulls/71"},"html":{"href":"https://github.com/ocaml/ocaml/pull/71"},"issue":{"href":"https://api.github.com/repos/ocaml/ocaml/issues/71"},"comments":{"href":"https://api.github.com/repos/ocaml/ocaml/issues/71/comments"},"review_comments":{"href":"https://api.github.com/repos/ocaml/ocaml/pulls/71/comments"},"review_comment":{"href":"https://api.github.com/repos/ocaml/ocaml/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ocaml/ocaml/pulls/71/commits"},"statuses":{"href":"https://api.github.com/repos/ocaml/ocaml/statuses/e79039fa3235d2b772c3f46c9be59253df3897de"}}}}
{"actor":{"display_login":"dra27"}}