Repository navigation
docs: a preloaded allocator conflicts with the bundled jemalloc - #2164
Conversation
|
Hi — a quick check on this docs change: is it something you'd want in? The branch builds and the checks are green (18 pass, 1 skipped). If there's no interest I'll go ahead and close it in ten days or so, no worries at all — I'd just rather keep my queue tidy than leave it sitting. |
|
|
||
| ### `fd` crashes when another memory allocator is preloaded | ||
|
|
||
| The Linux binaries link against jemalloc for speed, through the `use-jemalloc` feature that is on by |
There was a problem hiding this comment.
Whether it is on by default or not depends on the platform it was compiled fore
| > LD_PRELOAD=/usr/bin/mimalloc fd | ||
| ``` | ||
|
|
||
| makes the two disagree about which of them owns an allocation, and `fd` crashes. `fd` cannot detect |
There was a problem hiding this comment.
I think this is a little wordy. It's probably sufficient just to say that using LD_PRELOAD with a different allocation isn't supported, and suggest compiling without jemalloc if that is desired.
| > cargo build --release --no-default-features --features completions | ||
| ``` | ||
|
|
||
| The `completions` feature is listed separately because `--no-default-features` turns it off too. |
There was a problem hiding this comment.
FWIW the completions feature isn't really needed unless you want to be able to run fd --gen-completions
The released Linux binaries link jemalloc through the `use-jemalloc` feature, which is on by default but is only compiled in on some targets. Preloading another allocator there makes the two disagree about which of them owns an allocation, and fd crashes; that cannot be detected from inside fd, because the preloaded library is already answering when fd runs its first allocation. The troubleshooting section now says which targets, says it is unsupported, and gives the build that runs with a preloaded allocator: `cargo build --release --no-default-features`. No changelog entry: this changes no behaviour, per CONTRIBUTING. The README wording was drafted with an AI coding assistant.
a9bd193 to
d920b76
Compare
|
All three taken on
|
|
|
||
| The released Linux binaries use jemalloc, through the `use-jemalloc` feature. It is on by default, but | ||
| it is only compiled in on some targets: not on Windows, macOS, FreeBSD, OpenBSD, illumos, Android, | ||
| 32-bit musl or riscv64. There, preloading a different allocator is not supported, for example |
There was a problem hiding this comment.
The use of "There" here is unclear. Is it refering to the targets that are compiled with jemalloc, or that aren't?
| ### `fd` crashes when another memory allocator is preloaded | ||
|
|
||
| The released Linux binaries use jemalloc, through the `use-jemalloc` feature. It is on by default, but | ||
| it is only compiled in on some targets: not on Windows, macOS, FreeBSD, OpenBSD, illumos, Android, |
There was a problem hiding this comment.
I'm not sure about listing the targets that are excluded here. It has the potential to get out of date if the list is changed in Cargo.toml.
How about just saying that it is enabled by default for some targets.
The list goes stale as soon as the cfg in Cargo.toml changes, and "There" did not say whether it meant the targets that have jemalloc or the ones that do not.
|
Both taken in |
fdlinks jemalloc through theuse-jemallocfeature, which is enabled by default for some targets. Preloading another allocator (LD_PRELOAD=/usr/bin/mimalloc fd) makes the two disagree about which of them owns an allocation, andfdcrashes. #2121 asked for either a normal run or a clear error; as tmccombs said there,fdcannot tell: the preloaded library is already the one answering by the time the first allocation happens.So this documents the conflict in the troubleshooting section, next to the other "fd does something surprising" entries: the crash, why it cannot be detected from inside
fd, andcargo build --release --no-default-featuresas the build that runs with a preloaded allocator.I could not reproduce the crash here: jemalloc is disabled on macOS, which is why #2121 is Linux-only. What I did verify is that the documented build compiles and the binary it produces runs.
Closes #2121
AI disclosure
The README wording and this description were drafted with an AI coding assistant; the change is documentation only and I have read it.