Repository navigation
allocator: Make jemalloc code optional - #44032
Conversation
|
What is an example of a usecase that needs both |
|
This is mainly to keep compatibility with current behavior - It allows us to opt-in to using the system allocator by simply enabling that feature, without requiring |
Or to maybe rephrase that - since we want to default to jemalloc (on most systems), jemalloc needs to be a default feature. But if you want to profile memory usage / use ASAN etc., then being able to just enable one feature without needing to disable default features is quite a convenience win. In the medium term I want to think more about how we can let the embedder define the allocator (see #44060), and in that case the problem would also go away. |
|
@mrobinson How can we proceed here? I could make the feature exclusive. If we added a new feature-group "standard-non-mutual-exclusive-features" (better name required), then switching allocators wouldn't be too bad flag wise. |
|
@jschwe Sorry for letting this sit so long -- it slipped off my plate. I think making the feature exclusive and starting to add feature groups sounds like a good option, rather than allowing contradictory build configurations. |
a79e2aa to
e0d764c
Compare
Add a feature, so we can avoid compiling the tikv-jemalloc crates, when they are not needed. Signed-off-by: Jonathan Schwender <[email protected]>
Signed-off-by: Jonathan Schwender <[email protected]>
Signed-off-by: Jonathan Schwender <[email protected]>
a078bf2 to
9001466
Compare
Signed-off-by: Jonathan Schwender <[email protected]>
f70fd3f to
b33cefb
Compare
remainder of previous approach Signed-off-by: Jonathan Schwender <[email protected]>
We want to fallback to libc if no allocator feature is selected. That doesn't cost us anything. Signed-off-by: Jonathan Schwender <[email protected]>
…locators Signed-off-by: Jonathan Schwender <[email protected]>
b33cefb to
41fdb44
Compare
apparently it's broken. Signed-off-by: Jonathan Schwender <[email protected]>
| # configuration with `--no-default-features` build | ||
| # | ||
| # A convenience feature to enable all default web features servo has. | ||
| default_web_features = ["clipboard", "webgpu", "webxr"] |
There was a problem hiding this comment.
It would be interesting to have a discussion on what should go in here (after this PR). I'd line towards almost everything? (gamepad is broken, I tried adding it, and linting failed.)
Signed-off-by: Jonathan Schwender <[email protected]>
Signed-off-by: Jonathan Schwender <[email protected]>
Signed-off-by: Jonathan Schwender <[email protected]>
Signed-off-by: Jonathan Schwender <[email protected]>
it was a default feature before, so lets keep it there. We can later adjust default features if needed in a dedicated PR Signed-off-by: Jonathan Schwender <[email protected]>
Not needed anymore, after adding `default_without_allocator`. Signed-off-by: Jonathan Schwender <[email protected]>
Signed-off-by: Jonathan Schwender <[email protected]>
Add a feature, so we can avoid compiling the tikv-jemalloc crates, when they are not needed. Reviewer feedback requested the jemalloc and and the system allocator backends to be mutually exclusive, meaning that `use-system-allocator` and the new `use-jemalloc` feature shouldn't be able to be used together. That leads to the removal of the `use-system-allocator` feature, since we can also detect the absense of custom allocator features instead, which means we remove on error path. For convenience purposes, this PR also adds feature groups, which bundle certain features: Our default web features, and bundled options. In servoshell we consolidate those into a `default_without_allocator` feature, so that in our ASAN build we can use the system allocator, while keeping other default dependencies. These feature groups should also be more generally useful, e.g. if we start feature-gating more web-platform features. Testing: Requires manual testing, to test the non-default allocator (system allocator) is still selected via `./mach build --no-default-features --features default_without_allocator`. --------- Signed-off-by: Jonathan Schwender <[email protected]>
Add a feature, so we can avoid compiling the tikv-jemalloc crates, when they are not needed.
Reviewer feedback requested the jemalloc and and the system allocator backends to be mutually exclusive, meaning that
use-system-allocatorand the newuse-jemallocfeature shouldn't be able to be used together.That leads to the removal of the
use-system-allocatorfeature, since we can also detect the absense of custom allocator features instead, which means we remove on error path.For convenience purposes, this PR also adds feature groups, which bundle certain features: Our default web features, and bundled options. In servoshell we consolidate those into a
default_without_allocatorfeature, so that in our ASAN build we can use the system allocator, while keeping other default dependencies.These feature groups should also be more generally useful, e.g. if we start feature-gating more web-platform features.
Testing: Requires manual testing, to test the non-default allocator (system allocator) is still selected via
./mach build --no-default-features --features default_without_allocator.