Skip to content

Commit

Permalink
LZMADictionarySize now allows the LZMA dictionary size to be increase…
Browse files Browse the repository at this point in the history
…d up to 1 GB from the previous maximum of 256 MB. Closes #179
  • Loading branch information
martijnlaan committed Feb 22, 2016
1 parent 3e7dbf5 commit f29d83e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
16 changes: 10 additions & 6 deletions ISHelp/isetup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3877,12 +3877,16 @@ Name: portablemode; Description: "Portable Mode"</pre></example>
<p><tt>lzma</tt> is the method of compression employed by the <extlink href="http://www.7-zip.org/">7-Zip LZMA</extlink> compressor. It typically compresses significantly better than the <tt>zip</tt> and <tt>bzip</tt> methods. However, depending on the compression level used, it can be significantly slower at compressing, and consume a <i>lot</i> more memory. The following table summarizes the approximate memory requirements for each of the supported <tt>lzma</tt> compression levels. If a compression level isn't specified, it defaults to <tt>max</tt>.</p>
<indent>
<table>
<tr><td></td><td><u>Decompression (dictionary size)</u></td><td><u>Compression</u></td></tr>
<tr><td></td><td><u>Decompression (dictionary size)</u></td><td><u>Compression (4 MB + 11 * dictionary size)</u></td></tr>
<tr><td><tt>fast</tt> (worst)</td><td>32 KB</td><td>3 MB</td></tr>
<tr><td><tt>normal</tt></td><td>2 MB</td><td>26 MB</td></tr>
<tr><td><tt>max</tt> (default)</td><td>8 MB</td><td>95 MB</td></tr>
<tr><td><tt>ultra</tt></td><td>32 MB</td><td>372 MB</td></tr>
<tr><td><tt>ultra64</tt> (best)</td><td>64 MB</td><td>676 MB</td></tr>
<tr><td><tt>max</tt> (default)</td><td>8 MB</td><td>92 MB</td></tr>
<tr><td><tt>ultra</tt></td><td>32 MB</td><td>356 MB</td></tr>
<tr><td><tt>ultra64</tt> (best)</td><td>64 MB</td><td>708 MB</td></tr>
<tr><td></td><td>128 MB</td><td>1.38 GB</td></tr>
<tr><td></td><td>256 MB</td><td>2.75 GB</td></tr>
<tr><td></td><td>512 MB</td><td>5.5 GB</td></tr>
<tr><td></td><td>1 GB</td><td>11 GB</td></tr>
</table>
</indent>
<p><tt>lzma2</tt> is the method of compression employed by the <extlink href="http://www.7-zip.org/">7-Zip LZMA2</extlink> compressor. LZMA2 is a modified version of LZMA that offers a better compression ratio for incompressible data (random data expands about 0.005%, compared to 1.35% with original LZMA), and optionally can compress multiple parts of large files in parallel, greatly increasing compression speed but with a possible reduction in compression ratio (see <link topic="setup_lzmanumblockthreads">LZMANumBlockThreads</link>). Like LZMA, it can consume a <i>lot</i> of memory; see the above table. If a compression level isn't specified, it defaults to <tt>max</tt>.</p>
Expand Down Expand Up @@ -5000,7 +5004,7 @@ SignTool=byparam format c:

<setuptopic directive="LZMABlockSize">
<setupvalid><tt>1024</tt> through <tt>262144</tt></setupvalid>
<setupdefault>4 * <link topic="setup_lzmadictionarysize">LZMADictionarySize</link></setupdefault>
<setupdefault>4 * <link topic="setup_lzmadictionarysize">LZMADictionarySize</link> with a minimum of 1024 and a maximum of 262144</setupdefault>
<body>
<p>Controls the block size used by the LZMA2 compressor, in kilobytes, when <link topic="setup_lzmanumblockthreads">LZMANumBlockThreads</link> is set to <tt>2</tt> or higher.</p>
<p>Note that setting this too high can negate the benefits of using multiple block threads. Typically, the block size should be no more than the total size of your data divided by the number of block threads.</p>
Expand All @@ -5021,7 +5025,7 @@ SignTool=byparam format c:
<body>
<p>Controls the dictionary size used by the LZMA and LZMA2 compressors, in kilobytes. A larger dictionary size can provide a better compression ratio at the expense of compression speed and memory requirements.</p>
<p>Review the memory requirements listed in the <link topic="setup_compression">Compression</link> topic before using.</p>
<p>If an "Out of memory" error is seen when a very large dictionary size is used, <link topic="setup_lzmauseseparateprocess">LZMAUseSeparateProcess</link> may need to be set.</p>
<p>If an "Out of memory" error is seen after increasing the dictionary size, <link topic="setup_lzmauseseparateprocess">LZMAUseSeparateProcess</link> may need to be set.</p>
<p><b>See also:</b><br/>
<link topic="setup_lzmablocksize">LZMABlockSize</link></p>
</body>
Expand Down
4 changes: 2 additions & 2 deletions Projects/Compile.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3931,10 +3931,10 @@ procedure TSetupCompiler.EnumSetup(const Line: PChar; const Ext, Ext2: Integer);
CompressProps.Algorithm := StrToIntRange(Value, 0, 1);
end;
ssLZMABlockSize: begin
CompressProps.BlockSize := StrToIntRange(Value, 1024, 262144) * 1024;
CompressProps.BlockSize := StrToIntRange(Value, 1024, 262144) * 1024; //search Lzma2Enc.c for kMaxSize to see this limit: 262144*1024==1<<28
end;
ssLZMADictionarySize: begin
CompressProps.DictionarySize := StrToIntRange(Value, 4, 262144) * 1024;
CompressProps.DictionarySize := StrToIntRange(Value, 4, 1048576) * 1024;
end;
ssLZMAMatchFinder: begin
if CompareText(Value, 'BT') = 0 then
Expand Down
2 changes: 1 addition & 1 deletion Projects/LZMADecomp.pas
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ TLZMAISzAlloc = record
{ To ensure we don't allocate inordinate amounts of memory in the event a
stream's header is corrupted, we limit the dictionary size to the maximum
size the compiler currently allows. }
MaxDictionarySize = 256 shl 20; { 256 MB }
MaxDictionarySize = 1024 shl 20; { 1 GB }

{$L lzma2\Decoder\ISLzmaDec.obj}
{$L lzma2\Decoder\ISLzma2Dec.obj}
Expand Down
1 change: 1 addition & 0 deletions whatsnew.htm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<li>To <a href="#installerprotect1">further</a> help protect installers against potential <a href="http://msdn.microsoft.com/en-us/library/ff919712.aspx">DLL preloading attacks</a>, Setup/Uninstall now calls SetDefaultDllDirectories if available to remove the application directory from the DLL search order. If SetDefaultDllDirectories is not available or cannot be called, it now additionally preloads a set of system DLLs known to be loaded unsafely by older or unpatched versions of Windows.</li>
<li><b>Change in default behavior:</b> the <tt>OutputBaseFileName</tt> [Setup] section directive now defaults to <tt>mysetup</tt> instead of <tt>setup</tt>. Setting it back to <tt>setup</tt> is not recommended: all executables named "setup.exe" are shimmed by Windows application compatibility to load additional DLLs, such as version.dll. These DLLs are loaded unsafely by Windows and can be hijacked. If you do so anyway, the compiler will issue a warning.</li>
<li>Added new [Files] section flags: <tt>sign</tt> and <tt>signonce</tt>. Instructs the compiler to digitally sign the original source files before storing them. Ignored if [Setup] section directive <tt>SignTool</tt> is not set. Inno Setup's own compiler files are now also signed.</li>
<li>[Setup] section directive <tt>LZMADictionarySize</tt> now allows the LZMA dictionary size to be increased up to 1 GB from the previous maximum of 256 MB. Review the memory requirements listed in the <tt>Compression</tt> topic before using!</li>
<li>Improved the "auto-retry" feature of the [Files] section: it now also retries if MoveFile failed even if the preceding DeleteFile succeeded. Additionally, if MoveFile keeps failing it will now register the file to be replaced on restart if the <tt>restartreplace</tt> [Files] section flag is used instead of displaying an error message.</li>
<li>Added official Armenian translation.</li>
<li>Inno Setup Preprocessor (ISPP) change: Added new function <tt>RemoveFileExt</tt>.</li>
Expand Down

0 comments on commit f29d83e

Please sign in to comment.