maxPreallocateSize property

int maxPreallocateSize
final

Largest output, in bytes, that will be allocated up front on the strength of what an archive's stream index claims.

The index is part of the archive, so the size in it is only as trustworthy as whoever produced the file. Ratios above 6000:1 are ordinary for repetitive data, so a small archive can honestly describe an output of hundreds of gigabytes, and a hostile one can describe an output that is not there at all. Beyond this the claim is not acted on: the buffer grows as the bytes actually arrive, which costs some copying and makes an inflated claim harmless. Decoding is not capped by it, nor is splitting the work across isolates, and uncompressedSize returns null above it rather than a number this decoder would not act on.

The default is xzDefaultMaxPreallocateSize, which is far lower on the web because a failed allocation there kills the page instead of throwing. Raise it where the memory is known to be there, lower it where a hostile archive is a real possibility.

Implementation

final int maxPreallocateSize;