Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
lzma_mt Struct Reference

Multithreading options. More...

#include <container.h>

Data Fields

uint32_t flags
 Flags.
 
uint32_t threads
 Number of worker threads to use.
 
uint64_t block_size
 Maximum uncompressed size of a Block.
 
uint32_t timeout
 Timeout to allow lzma_code() to return early.
 
uint32_t preset
 Compression preset (level and possible flags)
 
const lzma_filterfilters
 Filter chain (alternative to a preset)
 
lzma_check check
 Integrity check type.
 
lzma_reserved_enum reserved_enum1
 
lzma_reserved_enum reserved_enum2
 
lzma_reserved_enum reserved_enum3
 
uint32_t reserved_int1
 
uint32_t reserved_int2
 
uint32_t reserved_int3
 
uint32_t reserved_int4
 
uint64_t reserved_int5
 
uint64_t reserved_int6
 
uint64_t reserved_int7
 
uint64_t reserved_int8
 
void * reserved_ptr1
 
void * reserved_ptr2
 
void * reserved_ptr3
 
void * reserved_ptr4
 
uint64_t memlimit_threading
 Memory usage limit to reduce the number of threads.
 
uint64_t memlimit_stop
 Memory usage limit that should never be exceeded.
 

Detailed Description

Multithreading options.

Field Documentation

◆ block_size

uint64_t block_size

Maximum uncompressed size of a Block.

Encoder only: Maximum uncompressed size of a Block.

The encoder will start a new .xz Block every block_size bytes. Using LZMA_FULL_FLUSH or LZMA_FULL_BARRIER with lzma_code() the caller may tell liblzma to start a new Block earlier.

With LZMA2, a recommended block size is 2-4 times the LZMA2 dictionary size. With very small dictionaries, it is recommended to use at least 1 MiB block size for good compression ratio, even if this is more than four times the dictionary size. Note that these are only recommendations for typical use cases; feel free to use other values. Just keep in mind that using a block size less than the LZMA2 dictionary size is waste of RAM.

Set this to 0 to let liblzma choose the block size depending on the compression options. For LZMA2 it will be 3*dict_size or 1 MiB, whichever is more.

For each thread, about 3 * block_size bytes of memory will be allocated. This may change in later liblzma versions. If so, the memory usage will probably be reduced, not increased.

◆ check

lzma_check check

Integrity check type.

Encoder only: Integrity check type.

See check.h for available checks. The xz command line tool defaults to LZMA_CHECK_CRC64, which is a good choice if you are unsure.

◆ filters

const lzma_filter * filters

Filter chain (alternative to a preset)

Encoder only: Filter chain (alternative to a preset)

If this is NULL, the preset above is used. Otherwise the preset is ignored and the filter chain specified here is used.

◆ flags

uint32_t flags

Flags.

Set this to zero if no flags are wanted.

No flags are currently supported.

Set this to zero if no flags are wanted.

Encoder: No flags are currently supported.

Decoder: Bitwise-or of zero or more of the decoder flags: LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK, LZMA_TELL_ANY_CHECK, LZMA_IGNORE_CHECK, LZMA_CONCATENATED, LZMA_FAIL_FAST

Set this to zero if no flags are wanted.

Encoder: No flags are currently supported.

Decoder: Bitwise-or of zero or more of the decoder flags:

  • LZMA_TELL_NO_CHECK
  • LZMA_TELL_UNSUPPORTED_CHECK
  • LZMA_TELL_ANY_CHECK
  • LZMA_IGNORE_CHECK
  • LZMA_CONCATENATED
  • LZMA_FAIL_FAST

◆ memlimit_stop

uint64_t memlimit_stop

Memory usage limit that should never be exceeded.

Encoder: Ignored.

Decoder: If decompressing will need more than this amount of memory even in the single-threaded mode, then lzma_code() will return LZMA_MEMLIMIT_ERROR.

◆ memlimit_threading

uint64_t memlimit_threading

Memory usage limit to reduce the number of threads.

Encoder: Ignored.

Decoder:

If the number of threads has been set so high that more than memlimit_threading bytes of memory would be needed, the number of threads will be reduced so that the memory usage will not exceed memlimit_threading bytes. However, if memlimit_threading cannot be met even in single-threaded mode, then decoding will continue in single-threaded mode and memlimit_threading may be exceeded even by a large amount. That is, memlimit_threading will never make lzma_code() return LZMA_MEMLIMIT_ERROR. To truly cap the memory usage, see memlimit_stop below.

Setting memlimit_threading to UINT64_MAX or a similar huge value means that liblzma is allowed to keep the whole compressed file and the whole uncompressed file in memory in addition to the memory needed by the decompressor data structures used by each thread! In other words, a reasonable value limit must be set here or it will cause problems sooner or later. If you have no idea what a reasonable value could be, try lzma_physmem() / 4 as a starting point. Setting this limit will never prevent decompression of a file; this will only reduce the number of threads.

If memlimit_threading is greater than memlimit_stop, then the value of memlimit_stop will be used for both.

◆ preset

uint32_t preset

Compression preset (level and possible flags)

Encoder only: Compression preset.

The preset is set just like with lzma_easy_encoder(). The preset is ignored if filters below is non-NULL.

◆ reserved_enum1

lzma_reserved_enum reserved_enum1

Reserved member.

◆ reserved_enum2

lzma_reserved_enum reserved_enum2

Reserved member.

◆ reserved_enum3

lzma_reserved_enum reserved_enum3

Reserved member.

◆ reserved_int1

uint32_t reserved_int1

Reserved member.

◆ reserved_int2

uint32_t reserved_int2

Reserved member.

◆ reserved_int3

uint32_t reserved_int3

Reserved member.

◆ reserved_int4

uint32_t reserved_int4

Reserved member.

◆ reserved_int5

uint64_t reserved_int5

◆ reserved_int6

uint64_t reserved_int6

◆ reserved_int7

uint64_t reserved_int7

Reserved member.

◆ reserved_int8

uint64_t reserved_int8

Reserved member.

◆ reserved_ptr1

void * reserved_ptr1

Reserved member.

◆ reserved_ptr2

void * reserved_ptr2

Reserved member.

◆ reserved_ptr3

void * reserved_ptr3

Reserved member.

◆ reserved_ptr4

void * reserved_ptr4

Reserved member.

◆ threads

uint32_t threads

Number of worker threads to use.

◆ timeout

uint32_t timeout

Timeout to allow lzma_code() to return early.

Multithreading can make liblzma to consume input and produce output in a very bursty way: it may first read a lot of input to fill internal buffers, then no input or output occurs for a while.

In single-threaded mode, lzma_code() won't return until it has either consumed all the input or filled the output buffer. If this is done in multithreaded mode, it may cause a call lzma_code() to take even tens of seconds, which isn't acceptable in all applications.

To avoid very long blocking times in lzma_code(), a timeout (in milliseconds) may be set here. If lzma_code() would block longer than this number of milliseconds, it will return with LZMA_OK. Reasonable values are 100 ms or more. The xz command line tool uses 300 ms.

If long blocking times are fine for you, set timeout to a special value of 0, which will disable the timeout mechanism and will make lzma_code() block until all the input is consumed or the output buffer has been filled.

Note
Even with a timeout, lzma_code() might sometimes take somewhat long time to return. No timing guarantees are made.

Multithreading can make liblzma consume input and produce output in a very bursty way: it may first read a lot of input to fill internal buffers, then no input or output occurs for a while.

In single-threaded mode, lzma_code() won't return until it has either consumed all the input or filled the output buffer. If this is done in multithreaded mode, it may cause a call lzma_code() to take even tens of seconds, which isn't acceptable in all applications.

To avoid very long blocking times in lzma_code(), a timeout (in milliseconds) may be set here. If lzma_code() would block longer than this number of milliseconds, it will return with LZMA_OK. Reasonable values are 100 ms or more. The xz command line tool uses 300 ms.

If long blocking times are acceptable, set timeout to a special value of 0. This will disable the timeout mechanism and will make lzma_code() block until all the input is consumed or the output buffer has been filled.

Note
Even with a timeout, lzma_code() might sometimes take a long time to return. No timing guarantees are made.

The documentation for this struct was generated from the following files: