reintroduce jemalloc and use it as the Vec<T> and exchange allocator#14006
reintroduce jemalloc and use it as the Vec<T> and exchange allocator#14006bors merged 11 commits intorust-lang:masterfrom thestinger:jemalloc
Conversation
mk/rt.mk
Outdated
There was a problem hiding this comment.
We don't currently depend on autotools, and I think that is explicitly done. Can we fork jemalloc, configure it, check in ./configure and use the fork?
There was a problem hiding this comment.
yeah, we could do this via a fork - it would also be a good place to put the configure cache with the workaround for the Windows cross-compilation issue
|
cc me |
|
I think this is going to require further discussion before merging since there's some disagreement about how we should treat allocations that require special alignment. My preference is:
|
|
It's possible to build an allocator respecting alignment around It shouldn't be necessary to rewrite all of the standard collections in order to use types with alignment requirements higher than the platform's choice. The The exchange allocator itself has no The missing piece on *nix operating systems is an aligned
I don't really think this is a pressing need. I don't think there's a use case for using libc malloc instead of jemalloc, because it's portable to the same platforms as Rust. Debian and Fedora want us to provide an |
|
Statically linking jemalloc with mingw-w64 is broken. It could be dynamically linked there for now or left out... https://sourceforge.net/p/mingw-w64/bugs/395/ |
|
I discovered a workaround for the Windows issue, which is passing |
There was a problem hiding this comment.
Malloc uses 16 bytes as a default I think, shouldn't this use that?
There was a problem hiding this comment.
It uses 16 bytes on x86_64, but I think it uses 8 bytes on x86 and ARM. The only types we currently have with > 8 byte alignment are feature gated (f128, simd) so I'm using this as a hack until ~[T]/~str are removed. I think 8 is better since it won't regress anything.
This module only contains wrappers for malloc and realloc with out-of-memory checks.
…=Veykril Replace soft breaks in markdown with spaces cc rust-lang/rust-analyzer#13988 (comment)
Closes #11807