mirror of https://git.tukaani.org/xz.git
Add support for --enable-assume-ram=SIZE.
This commit is contained in:
parent
3782b3fee4
commit
29fd321033
16
INSTALL
16
INSTALL
|
@ -237,6 +237,22 @@ XZ Utils Installation
|
||||||
to optimize for size. You need to add -Os or equivalent
|
to optimize for size. You need to add -Os or equivalent
|
||||||
flag(s) to CFLAGS manually.
|
flag(s) to CFLAGS manually.
|
||||||
|
|
||||||
|
--enable-assume-ram=SIZE
|
||||||
|
On the most common operating systems, XZ Utils is able to
|
||||||
|
detect the amount of physical memory on the system. This
|
||||||
|
information is used to set the default memory usage limit.
|
||||||
|
|
||||||
|
On some systems, there is no code to detect the amount of
|
||||||
|
RAM though. Using --enable-assume-ram one can set how much
|
||||||
|
memory to assume on these systems. SIZE is given as MiB.
|
||||||
|
The default is 32 MiB, which is probably too low for most
|
||||||
|
systems, but it is enough to allow decompressing .xz files
|
||||||
|
created with the default settings.
|
||||||
|
|
||||||
|
Feel free to send patches to add support for detecting
|
||||||
|
the amount of RAM on the operating system you use. See
|
||||||
|
src/common/tuklib_physmem.c for details.
|
||||||
|
|
||||||
--disable-threads
|
--disable-threads
|
||||||
Disable threading support. This makes some things
|
Disable threading support. This makes some things
|
||||||
thread-unsafe, meaning that if multithreaded application
|
thread-unsafe, meaning that if multithreaded application
|
||||||
|
|
24
configure.ac
24
configure.ac
|
@ -380,6 +380,30 @@ AC_MSG_RESULT([$enable_threads])
|
||||||
# We use the actual result a little later.
|
# We use the actual result a little later.
|
||||||
|
|
||||||
|
|
||||||
|
#########################
|
||||||
|
# Assumed amount of RAM #
|
||||||
|
#########################
|
||||||
|
|
||||||
|
# We use 32 MiB as default, because it should be small enough for most
|
||||||
|
# cases and allows decompressing files compressed with the default settings.
|
||||||
|
# Probably it is too small for most systems, but it's safer to guess too low.
|
||||||
|
AC_MSG_CHECKING([how much RAM to assume if the real amount is unknown])
|
||||||
|
AC_ARG_ENABLE([assume-ram], AC_HELP_STRING([--enable-assume-ram=SIZE],
|
||||||
|
[If and only if the real amount of RAM cannot be determined,
|
||||||
|
assume SIZE MiB. The default is 32 MiB. This affects the
|
||||||
|
default memory usage limit.]),
|
||||||
|
[], [enable_assume_ram=32])
|
||||||
|
assume_ram_check=`echo "$enable_assume_ram" | tr -d 0123456789`
|
||||||
|
if test -z "$enable_assume_ram" || test -n "$assume_ram_check"; then
|
||||||
|
AC_MSG_RESULT([])
|
||||||
|
AC_MSG_ERROR([--enable-assume-ram accepts only an integer argument])
|
||||||
|
fi
|
||||||
|
AC_MSG_RESULT([$enable_assume_ram MiB])
|
||||||
|
AC_DEFINE_UNQUOTED([ASSUME_RAM], [$enable_assume_ram],
|
||||||
|
[How many MiB of RAM to assume if the real amount cannot
|
||||||
|
be determined.])
|
||||||
|
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
# xz/xzdec/lzmadec linkage against liblzma #
|
# xz/xzdec/lzmadec linkage against liblzma #
|
||||||
############################################
|
############################################
|
||||||
|
|
|
@ -68,11 +68,10 @@ hardware_memlimit_set_percentage(uint32_t percentage)
|
||||||
|
|
||||||
uint64_t mem = tuklib_physmem();
|
uint64_t mem = tuklib_physmem();
|
||||||
|
|
||||||
// If we cannot determine the amount of RAM, assume 32 MiB. Maybe
|
// If we cannot determine the amount of RAM, use the assumption
|
||||||
// even that is too much on some systems. But on most systems it's
|
// defined by the configure script.
|
||||||
// far too little, and can be annoying.
|
|
||||||
if (mem == 0)
|
if (mem == 0)
|
||||||
mem = UINT64_C(32) * 1024 * 1024;
|
mem = (uint64_t)(ASSUME_RAM) * 1024 * 1024;
|
||||||
|
|
||||||
memlimit = percentage * mem / 100;
|
memlimit = percentage * mem / 100;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -106,9 +106,10 @@ memlimit_set_percentage(uint32_t percentage)
|
||||||
{
|
{
|
||||||
uint64_t mem = tuklib_physmem();
|
uint64_t mem = tuklib_physmem();
|
||||||
|
|
||||||
// If we cannot determine the amount of RAM, assume 32 MiB.
|
// If we cannot determine the amount of RAM, use the assumption
|
||||||
|
// set by the configure script.
|
||||||
if (mem == 0)
|
if (mem == 0)
|
||||||
mem = UINT64_C(32) * 1024 * 1024;
|
mem = (uint64_t)(ASSUME_RAM) * 1024 * 1024;
|
||||||
|
|
||||||
memlimit = percentage * mem / 100;
|
memlimit = percentage * mem / 100;
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue