Cap the LZMA2 thread count so peak compression memory no longer scales with the host core count. The encoder splits 'mt' as (block-threads x match-finder-threads); bt4 (Normal and above) uses 2 match-finder threads, so total mt = 2 x block-threads, and block-threads is what multiplies memory. Allow up to 2 block-threads on 64-bit (mt=4) and a single solid block on 32-bit (mt=2) where the address s
| 79 | // behaviour and keeps peak memory close to a single dictionary. |
| 80 | // Returns 0 to keep the library default (one thread per processor). |
| 81 | UInt32 ThreadCountForLevel(ZipCreate::CompressionLevel level) |
| 82 | { |
| 83 | switch (level) |
| 84 | { |
| 85 | case ZipCreate::Normal: |
| 86 | case ZipCreate::Maximum: |
| 87 | case ZipCreate::Ultra: |
| 88 | { |
| 89 | const UInt32 cap = 2u; |
| 90 | const UInt32 cores = ProcessorCount(); |
| 91 | return cores < cap ? cores : cap; |
| 92 | } |
| 93 | default: |
| 94 | return 0; |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | void StoreFileHashes(OrcArchive::ArchiveItems& items, bool releaseInputStreams) |
| 99 | { |
no test coverage detected