-
Notifications
You must be signed in to change notification settings - Fork 113
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
Add bindings to all jemalloc public functions #21
Add bindings to all jemalloc public functions #21
Conversation
The documented order is (number of objects, size of each object), though in practice they end up being multiplied together and so are somewhat interchangeable.
FreeType: don’t use usable_size() as deallocation size Instead use C-level malloc()/free() so that the size doesn’t need to be known during deallocation, since FreeType doesn’t provide it. Hopefully fixes #19058 Depends on https://github.com/alexcrichton/jemallocator/pull/21
Thanks! The signature of |
It’s quite possible since I translated from C declarations on the man page by hand, but this one seems to match? #[link_name = "_rjem_sallocx"]
pub fn sallocx(ptr: *mut c_void, flags: c_int) -> size_t; http://jemalloc.net/jemalloc.3.html size_t sallocx( void *ptr,
int flags); |
No idea myself, I'm just the messenger saying that CI is red |
This a warning-treated-as-error in C code that this PR didn’t modify. Maybe Travis updated their compiler version? Does this error happen on master if you hit the retry button? |
Mind looking into this? This is a test verifying the C API is correct. You added bindings for |
Oh sorry, I thought this C code was part of jemalloc, I didn’t realize it was generated from Rust declarations. Looking. |
That is, those documented in http://jemalloc.net/jemalloc.3.html For example `malloc` and `free` can be useful when implementing callbacks for a C library that doesn’t provide a size when deallocating: https://www.freetype.org/freetype2/docs/reference/ft2-system_interface.html
fff3f95
to
e6ea8a9
Compare
Alright, pushed with a fix. The problem was that man page says |
FreeType: don’t use usable_size() as deallocation size Instead use C-level malloc()/free() so that the size doesn’t need to be known during deallocation, since FreeType doesn’t provide it. Hopefully fixes #19058 Depends on https://github.com/alexcrichton/jemallocator/pull/21 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19061) <!-- Reviewable:end -->
I'm a tad bit wary about pub mod ffi {
pub use jemalloc_sys::*;
} ? |
IIRC |
Ok... Can the version bumps be left out? I'm sort of wary with a release-per-PR, so maybe something like |
I’ve already made a Servo try build using these changes through I can remove the version increment if you prefer. I’ve included it to signal that I’d appreciate a crates.io version including these changes to be published at your convenience. This doesn’t necessarily mean a separate version for every single PR, batching them is totally fine. A new version would enable this Servo PR to land as-is (with |
Nah it's fine to have, I just wanted to make sure that it was tested before release. So many PRs on other projects tend to have 3 successive releases in a row as they were never tested... In any case, thanks again! |
FreeType: don’t use usable_size() as deallocation size Instead use C-level malloc()/free() so that the size doesn’t need to be known during deallocation, since FreeType doesn’t provide it. Hopefully fixes #19058 Depends on https://github.com/alexcrichton/jemallocator/pull/21 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19061) <!-- Reviewable:end -->
…on size (from servo:ft-alloc); r=mbrubeck Instead use C-level malloc()/free() so that the size doesn’t need to be known during deallocation, since FreeType doesn’t provide it. Hopefully fixes servo/servo#19058 Depends on https://github.com/alexcrichton/jemallocator/pull/21 Source-Repo: https://github.com/servo/servo Source-Revision: f18099118a5be17b5b1d6fdcc3352a98a1499e6a --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 8087ee658a0ca822c6cdc85c00cfc8984b1fa668
…on size (from servo:ft-alloc); r=mbrubeck Instead use C-level malloc()/free() so that the size doesn’t need to be known during deallocation, since FreeType doesn’t provide it. Hopefully fixes servo/servo#19058 Depends on https://github.com/alexcrichton/jemallocator/pull/21 Source-Repo: https://github.com/servo/servo Source-Revision: f18099118a5be17b5b1d6fdcc3352a98a1499e6a
…on size (from servo:ft-alloc); r=mbrubeck Instead use C-level malloc()/free() so that the size doesn’t need to be known during deallocation, since FreeType doesn’t provide it. Hopefully fixes servo/servo#19058 Depends on https://github.com/alexcrichton/jemallocator/pull/21 Source-Repo: https://github.com/servo/servo Source-Revision: f18099118a5be17b5b1d6fdcc3352a98a1499e6a UltraBlame original commit: 7f574eb1f99cc0561b58c045a8cba0552e7ee930
…on size (from servo:ft-alloc); r=mbrubeck Instead use C-level malloc()/free() so that the size doesn’t need to be known during deallocation, since FreeType doesn’t provide it. Hopefully fixes servo/servo#19058 Depends on https://github.com/alexcrichton/jemallocator/pull/21 Source-Repo: https://github.com/servo/servo Source-Revision: f18099118a5be17b5b1d6fdcc3352a98a1499e6a UltraBlame original commit: 7f574eb1f99cc0561b58c045a8cba0552e7ee930
…on size (from servo:ft-alloc); r=mbrubeck Instead use C-level malloc()/free() so that the size doesn’t need to be known during deallocation, since FreeType doesn’t provide it. Hopefully fixes servo/servo#19058 Depends on https://github.com/alexcrichton/jemallocator/pull/21 Source-Repo: https://github.com/servo/servo Source-Revision: f18099118a5be17b5b1d6fdcc3352a98a1499e6a UltraBlame original commit: 7f574eb1f99cc0561b58c045a8cba0552e7ee930
Signed-off-by: Jay Lee <BusyJayLee@gmail.com>
That is, those documented in http://jemalloc.net/jemalloc.3.html
For example
malloc
andfree
can be useful when implementing callbacks for a C library that doesn’t provide a size when deallocating: https://www.freetype.org/freetype2/docs/reference/ft2-system_interface.html