diff options
author | Przemyslaw Skibinski <inikep@gmail.com> | 2017-03-10 19:49:25 (GMT) |
---|---|---|
committer | Przemyslaw Skibinski <inikep@gmail.com> | 2017-03-10 19:49:25 (GMT) |
commit | cb1671955a056302c804ff09d6edf0e095566274 (patch) | |
tree | 22de7580009069fa8fe1e6b643ccb870b00f6872 /programs | |
parent | 517d446d7ecdb3915e71b04a70514eef3f4ec765 (diff) | |
download | lz4-cb1671955a056302c804ff09d6edf0e095566274.zip lz4-cb1671955a056302c804ff09d6edf0e095566274.tar.gz lz4-cb1671955a056302c804ff09d6edf0e095566274.tar.bz2 |
bench.c: respect LZ4_MAX_INPUT_SIZE limit
Diffstat (limited to 'programs')
-rw-r--r-- | programs/bench.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/programs/bench.c b/programs/bench.c index 71d3896..77a9e3f 100644 --- a/programs/bench.c +++ b/programs/bench.c @@ -455,8 +455,13 @@ static void BMK_benchFileTable(const char** fileNamesTable, unsigned nbFiles, benchedSize = BMK_findMaxMem(totalSizeToLoad * 3) / 3; if (benchedSize==0) EXM_THROW(12, "not enough memory"); if ((U64)benchedSize > totalSizeToLoad) benchedSize = (size_t)totalSizeToLoad; - if (benchedSize < totalSizeToLoad) - DISPLAY("Not enough memory; testing %u MB only...\n", (U32)(benchedSize >> 20)); + if (benchedSize > LZ4_MAX_INPUT_SIZE) { + benchedSize = LZ4_MAX_INPUT_SIZE; + DISPLAY("File(s) bigger than LZ4's max input size; testing %u MB only...\n", (U32)(benchedSize >> 20)); + } else { + if (benchedSize < totalSizeToLoad) + DISPLAY("Not enough memory; testing %u MB only...\n", (U32)(benchedSize >> 20)); + } srcBuffer = malloc(benchedSize + !benchedSize); /* avoid alloc of zero */ if (!srcBuffer) EXM_THROW(12, "not enough memory"); |