aboutsummaryrefslogtreecommitdiff
path: root/src/xz/coder.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2010-08-07 20:45:18 +0300
committerLasse Collin <lasse.collin@tukaani.org>2010-08-07 20:45:18 +0300
commit792331bdee706aa852a78b171040ebf814c6f3ae (patch)
tree255e92da193003ad47eb29ccf47ab353d93cafa5 /src/xz/coder.c
parentAdd missing const to a global constant in xz. (diff)
downloadxz-792331bdee706aa852a78b171040ebf814c6f3ae.tar.xz
Disable the memory usage limiter by default.
For several people, the limiter causes bigger problems that it solves, so it is better to have it disabled by default. Those who want to have a limiter by default need to enable it via the environment variable XZ_DEFAULTS. Support for environment variable XZ_DEFAULTS was added. It is parsed before XZ_OPT and technically identical with it. The intended uses differ quite a bit though; see the man page. The memory usage limit can now be set separately for compression and decompression using --memlimit-compress and --memlimit-decompress. To set both at once, -M or --memlimit can be used. --memory was retained as a legacy alias for --memlimit for backwards compatibility. The semantics of --info-memory were changed in backwards incompatible way. Compatibility wasn't meaningful due to changes in the memory usage limiter functionality. The memory usage limiter info is no longer shown at the bottom of xz --long -help. The memory usage limiter support for removed completely from xzdec. xz's man page was updated to match the above changes. Various unrelated fixes were also made to the man page.
Diffstat (limited to 'src/xz/coder.c')
-rw-r--r--src/xz/coder.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/xz/coder.c b/src/xz/coder.c
index ff50d63c..093d5f29 100644
--- a/src/xz/coder.c
+++ b/src/xz/coder.c
@@ -169,7 +169,7 @@ coder_set_compression_settings(void)
// If using --format=raw, we can be decoding. The memusage function
// also validates the filter chain and the options used for the
// filters.
- const uint64_t memory_limit = hardware_memlimit_get();
+ const uint64_t memory_limit = hardware_memlimit_get(opt_mode);
uint64_t memory_usage;
if (opt_mode == MODE_COMPRESS)
memory_usage = lzma_raw_encoder_memusage(filters);
@@ -406,12 +406,14 @@ coder_init(file_pair *pair)
case FORMAT_XZ:
ret = lzma_stream_decoder(&strm,
- hardware_memlimit_get(), flags);
+ hardware_memlimit_get(
+ MODE_DECOMPRESS), flags);
break;
case FORMAT_LZMA:
ret = lzma_alone_decoder(&strm,
- hardware_memlimit_get());
+ hardware_memlimit_get(
+ MODE_DECOMPRESS));
break;
case FORMAT_RAW: