{"action":"created","issue":{"url":"https://api.github.com/repos/kripken/emscripten/issues/4469","repository_url":"https://api.github.com/repos/kripken/emscripten","labels_url":"https://api.github.com/repos/kripken/emscripten/issues/4469/labels{/name}","comments_url":"https://api.github.com/repos/kripken/emscripten/issues/4469/comments","events_url":"https://api.github.com/repos/kripken/emscripten/issues/4469/events","html_url":"https://github.com/kripken/emscripten/pull/4469","id":169822880,"number":4469,"title":"Fix sbrk bug","user":{"login":"aheejin","id":8726997,"avatar_url":"https://avatars.githubusercontent.com/u/8726997?v=3","gravatar_id":"","url":"https://api.github.com/users/aheejin","html_url":"https://github.com/aheejin","followers_url":"https://api.github.com/users/aheejin/followers","following_url":"https://api.github.com/users/aheejin/following{/other_user}","gists_url":"https://api.github.com/users/aheejin/gists{/gist_id}","starred_url":"https://api.github.com/users/aheejin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aheejin/subscriptions","organizations_url":"https://api.github.com/users/aheejin/orgs","repos_url":"https://api.github.com/users/aheejin/repos","events_url":"https://api.github.com/users/aheejin/events{/privacy}","received_events_url":"https://api.github.com/users/aheejin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-07T23:41:26Z","updated_at":"2016-08-07T23:45:47Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/kripken/emscripten/pulls/4469","html_url":"https://github.com/kripken/emscripten/pull/4469","diff_url":"https://github.com/kripken/emscripten/pull/4469.diff","patch_url":"https://github.com/kripken/emscripten/pull/4469.patch"},"body":"In function _sbrk, it sets Runtime.dynamicAlloc function to some error\r\nfunction to prevent reentrance. But it does not set Runtime.dynamicAlloc\r\nto the original dynamicAlloc function anywhere. So, effectively, once\r\n_sbrk is called, we cannot call _malloc ever again, because _malloc\r\ncalls Runtime.dynamicAlloc.\r\n\r\nIn asm.js, this problem did not appear because there are two _malloc\r\nfunctions in the resulting js code, where one is _malloc from library.js\r\nand the other is _malloc compiled from libc. And all calls to _malloc\r\ncalled the version in libc, which does not call Runtime.dynamicAlloc.\r\n\r\nBut in WebAssembly, some functions in js code (like\r\n___cxa_find_matching_catch) calls _malloc and this calls _malloc in\r\nlibrary.js, because there is no other _malloc in this case.\r\nSo this fails:\r\n_sbrk(N);\r\n_malloc(M);\r\nwhere N and M is any number."},"comment":{"url":"https://api.github.com/repos/kripken/emscripten/issues/comments/238116709","html_url":"https://github.com/kripken/emscripten/pull/4469#issuecomment-238116709","issue_url":"https://api.github.com/repos/kripken/emscripten/issues/4469","id":238116709,"user":{"login":"aheejin","id":8726997,"avatar_url":"https://avatars.githubusercontent.com/u/8726997?v=3","gravatar_id":"","url":"https://api.github.com/users/aheejin","html_url":"https://github.com/aheejin","followers_url":"https://api.github.com/users/aheejin/followers","following_url":"https://api.github.com/users/aheejin/following{/other_user}","gists_url":"https://api.github.com/users/aheejin/gists{/gist_id}","starred_url":"https://api.github.com/users/aheejin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aheejin/subscriptions","organizations_url":"https://api.github.com/users/aheejin/orgs","repos_url":"https://api.github.com/users/aheejin/repos","events_url":"https://api.github.com/users/aheejin/events{/privacy}","received_events_url":"https://api.github.com/users/aheejin/received_events","type":"User","site_admin":false},"created_at":"2016-08-07T23:45:46Z","updated_at":"2016-08-07T23:45:46Z","body":"@dschuff "}}
{"actor":{"display_login":"aheejin"}}