This repository was archived by the owner on Aug 25, 2025. It is now read-only.
Use at most 8 threads for the xz stream#98
Merged
alexcrichton merged 1 commit intorust-lang:masterfrom Aug 28, 2019
Merged
Conversation
At preset 6, xz2 uses about 173MB of memory per thread. This adds up
quickly -- e.g. over 8GB of memory on a 48-CPU machine. If you happen to
try this in a 32-bit build, you'll get `LZMA_MEM_ERROR`.
We can limit this to a heuristic maximum number of threads to avoid
using so much memory, like xz's [`04_compress_easy_mt` example].
// The number 8 is arbitrarily chosen and may be too low or
// high depending on the compression preset and the computer
// being used.
[`04_compress_easy_mt` example]: https://github.com/xz-mirror/xz/blob/de1f47b2b40e960b7bc3acba754f66dd19705921/doc/examples/04_compress_easy_mt.c#L71
|
(rust_highfive has picked a reviewer for you, use r? to override) |
Member
Author
|
This is not hypothetical -- I hit this error in a Fedora i686 build. The build machine had 2 socket Xeon E5-2670v3 (48 CPUs) with 128GB memory, but of course a 32-bit build has more limited address space. It ended with: |
Member
|
Oh wow, now that's gnarly! |
Centril
added a commit
to Centril/rust
that referenced
this pull request
Aug 29, 2019
…Simulacrum Update rust-installer to limit memory use See rust-lang/rust-installer#98 -- on a many-core machine, the xz memory for so many threads is more than a 32-bit process can handle. The xz stream is now limited to 8 threads. r? @alexcrichton
Centril
added a commit
to Centril/rust
that referenced
this pull request
Aug 29, 2019
…Simulacrum Update rust-installer to limit memory use See rust-lang/rust-installer#98 -- on a many-core machine, the xz memory for so many threads is more than a 32-bit process can handle. The xz stream is now limited to 8 threads. r? @alexcrichton
Centril
added a commit
to Centril/rust
that referenced
this pull request
Aug 29, 2019
…Simulacrum Update rust-installer to limit memory use See rust-lang/rust-installer#98 -- on a many-core machine, the xz memory for so many threads is more than a 32-bit process can handle. The xz stream is now limited to 8 threads. r? @alexcrichton
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
At preset 6, xz2 uses about 173MB of memory per thread. This adds up
quickly -- e.g. over 8GB of memory on a 48-CPU machine. If you happen to
try this in a 32-bit build, you'll get
LZMA_MEM_ERROR.We can limit this to a heuristic maximum number of threads to avoid
using so much memory, like xz's
04_compress_easy_mtexample.