We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
__rust_dealloc
sdallocx
1 parent 1b427b3 commit 0f657acCopy full SHA for 0f657ac
compiler/rustc/src/main.rs
@@ -34,6 +34,15 @@
34
// https://github.com/rust-lang/rust/commit/b90cfc887c31c3e7a9e6d462e2464db1fe506175#diff-43914724af6e464c1da2171e4a9b6c7e607d5bc1203fa95c0ab85be4122605ef
35
// for an example of how to do so.
36
37
+/// This redirects `__rust_dealloc` to jemalloc so it can make use of the size of the allocation.
38
+#[cfg(feature = "jemalloc-sys")]
39
+#[no_mangle]
40
+pub unsafe extern "C" fn __rust_dealloc(ptr: *mut u8, size: usize, _align: usize) {
41
+ unsafe { jemalloc_sys::sdallocx(ptr.cast(), size, 0) }
42
+ #[used]
43
+ static _USED: unsafe extern "C" fn(*mut u8, usize, usize) = __rust_dealloc;
44
+}
45
+
46
#[unix_sigpipe = "sig_dfl"]
47
fn main() {
48
// See the comment at the top of this file for an explanation of this.
0 commit comments