{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/31976","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/31976/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/31976/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/31976/events","html_url":"https://github.com/rust-lang/rust/pull/31976","id":137359019,"number":31976,"title":"Add __rust_unsized_deallocate for C libraries to hook into.","user":{"login":"michaelwu","id":719931,"avatar_url":"https://avatars.githubusercontent.com/u/719931?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelwu","html_url":"https://github.com/michaelwu","followers_url":"https://api.github.com/users/michaelwu/followers","following_url":"https://api.github.com/users/michaelwu/following{/other_user}","gists_url":"https://api.github.com/users/michaelwu/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelwu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelwu/subscriptions","organizations_url":"https://api.github.com/users/michaelwu/orgs","repos_url":"https://api.github.com/users/michaelwu/repos","events_url":"https://api.github.com/users/michaelwu/events{/privacy}","received_events_url":"https://api.github.com/users/michaelwu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"alexcrichton","id":64996,"avatar_url":"https://avatars.githubusercontent.com/u/64996?v=3","gravatar_id":"","url":"https://api.github.com/users/alexcrichton","html_url":"https://github.com/alexcrichton","followers_url":"https://api.github.com/users/alexcrichton/followers","following_url":"https://api.github.com/users/alexcrichton/following{/other_user}","gists_url":"https://api.github.com/users/alexcrichton/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcrichton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcrichton/subscriptions","organizations_url":"https://api.github.com/users/alexcrichton/orgs","repos_url":"https://api.github.com/users/alexcrichton/repos","events_url":"https://api.github.com/users/alexcrichton/events{/privacy}","received_events_url":"https://api.github.com/users/alexcrichton/received_events","type":"User","site_admin":false},"milestone":null,"comments":19,"created_at":"2016-02-29T20:13:19Z","updated_at":"2016-03-04T11:18:39Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rust-lang/rust/pulls/31976","html_url":"https://github.com/rust-lang/rust/pull/31976","diff_url":"https://github.com/rust-lang/rust/pull/31976.diff","patch_url":"https://github.com/rust-lang/rust/pull/31976.patch"},"body":"__rust_deallocate requires a size to be passed in, especially when jemalloc is used. Most C/C++ libraries don't use sized deallocation, so this allows non-rust code to hook into Rust's allocator without changing every free() call.\r\n\r\nHaven't tested this beyond building yet, but I'm putting this PR out first to see if the idea sounds ok. I'm adding sized allocation support to Spidermonkey https://bugzilla.mozilla.org/show_bug.cgi?id=1250998 but not everything can easily be converted to sized deallocation. The __rust_* functions are being used to hook into rust's allocator."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/192237948","html_url":"https://github.com/rust-lang/rust/pull/31976#issuecomment-192237948","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/31976","id":192237948,"user":{"login":"nagisa","id":679122,"avatar_url":"https://avatars.githubusercontent.com/u/679122?v=3","gravatar_id":"","url":"https://api.github.com/users/nagisa","html_url":"https://github.com/nagisa","followers_url":"https://api.github.com/users/nagisa/followers","following_url":"https://api.github.com/users/nagisa/following{/other_user}","gists_url":"https://api.github.com/users/nagisa/gists{/gist_id}","starred_url":"https://api.github.com/users/nagisa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nagisa/subscriptions","organizations_url":"https://api.github.com/users/nagisa/orgs","repos_url":"https://api.github.com/users/nagisa/repos","events_url":"https://api.github.com/users/nagisa/events{/privacy}","received_events_url":"https://api.github.com/users/nagisa/received_events","type":"User","site_admin":false},"created_at":"2016-03-04T11:18:39Z","updated_at":"2016-03-04T11:18:39Z","body":"> OSX, glibc, bionic, musl, jemalloc, tcmalloc, dlmalloc, and windows all provide functions for determining the usable size of a pointer.\r\n\r\nAnd some toy allocator somebody implements at some point in the future won’t. Instead it will rely on Rust always passing in correct sizes. With this change in place allocators like that won’t be possible anymore."}}