Erik Jan Tromp wrote:
I had assumed (& hoped) plzip would attempt to use as much ram as
possible, scale back the number of threads if/when necessary, then
throw an error only if there was insufficient memory for a single
thread.
I have just implemented such scaling down for the 32 bit case. Please,
test the attached patch against plzip-1.6. I plan to release shortly a
new version of plzip with this feature.
Best regards,
Antonio.
--- main.cc~ 2017-03-16 18:44:50.000000000 +0100
+++ main.cc 2017-12-11 13:13:14.000000000 +0100
@@ -678,7 +678,16 @@
std::max( data_size, LZ_min_dictionary_size() );
if( num_workers <= 0 )
+ {
+ if( sizeof (void *) <= 4 ) // use less than 2 GiB on 32 bit systems
+ {
+ const long long mem =
+ 11LL * encoder_options.dictionary_size + 3LL * data_size;
+ const int nmax32 = ( 0x7FFFFFFF > mem ) ? 0x7FFFFFFF / mem : 1;
+ if( max_workers > nmax32 ) max_workers = nmax32;
+ }
num_workers = std::min( num_online, max_workers );
+ }
if( !to_stdout && program_mode != m_test &&
( filenames_given || default_output_filename.size() ) )
_______________________________________________
Lzip-bug mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lzip-bug