Incorrect estimated memory and number of blocks in DynamicConvert with OTB_MAX_RAM_HINT=4096
Description
With the following example in DynamicConvert, setting OTB_MAX_RAM_HINT=2250 results in:
2018-12-04 14:31:59 (INFO): Estimated memory for full processing: 2299.47MB (avail.: 2250 MB), optimal image partitioning: 2 blocks
2018-12-04 14:31:59 (INFO): Estimation will be performed in 4 blocks of 7168x6144 pixels
But increasing to OTB_MAX_RAM_HINT=4096 results in:
018-12-04 14:32:36 (INFO): Estimated memory for full processing: 1.109e+07MB (avail.: 4096 MB), optimal image partitioning: 2708 blocks
2018-12-04 14:32:36 (INFO): File out_test.tif will be written in 2916 blocks of 205x205 pixels
See full log below.
Steps to reproduce
poughov@pc-victor ~ OTB_MAX_RAM_HINT=2250 time otbcli_DynamicConvert -in T44NNN_20181129T050551_B08.jp2 -out out_test.tif
2018-12-04 14:31:59 (INFO): No kwl metadata found in file T44NNN_20181129T050551_B08.jp2
2018-12-04 14:31:59 (INFO): Default RAM limit for OTB is 2250 MB
2018-12-04 14:31:59 (INFO): GDAL maximum cache size is 383 MB
2018-12-04 14:31:59 (INFO): OTB will use at most 8 threads
2018-12-04 14:31:59 (INFO): Estimated memory for full processing: 2299.47MB (avail.: 2250 MB), optimal image partitioning: 2 blocks
2018-12-04 14:31:59 (INFO): Estimation will be performed in 4 blocks of 7168x6144 pixels
Computing shrink Image for min/max estimation...: 100% [**************************************************] (5 seconds)
2018-12-04 14:32:05 (INFO): Estimated memory for full processing: 1724.62MB (avail.: 2250 MB), optimal image partitioning: 1 blocks
2018-12-04 14:32:05 (INFO): File out_test.tif will be written in 1 blocks of 10980x10980 pixels
Writing out_test.tif...: 100% [**************************************************] (4 seconds)
56.85user 1.54system 0:10.38elapsed 562%CPU (0avgtext+0avgdata 2136324maxresident)k
0inputs+235656outputs (0major+933435minor)pagefaults 0swaps
poughov@pc-victor ~ OTB_MAX_RAM_HINT=4096 time otbcli_DynamicConvert -in T44NNN_20181129T050551_B08.jp2 -out out_test.tif
2018-12-04 14:32:30 (INFO): No kwl metadata found in file T44NNN_20181129T050551_B08.jp2
2018-12-04 14:32:30 (INFO): Default RAM limit for OTB is 4096 MB
2018-12-04 14:32:30 (INFO): GDAL maximum cache size is 383 MB
2018-12-04 14:32:30 (INFO): OTB will use at most 8 threads
2018-12-04 14:32:30 (INFO): Estimated memory for full processing: 2299.47MB (avail.: 4096 MB), optimal image partitioning: 1 blocks
2018-12-04 14:32:30 (INFO): Estimation will be performed in 1 blocks of 10980x10980 pixels
Computing shrink Image for min/max estimation...: 100% [**************************************************] (5 seconds)
2018-12-04 14:32:36 (INFO): Estimated memory for full processing: 1.109e+07MB (avail.: 4096 MB), optimal image partitioning: 2708 blocks
2018-12-04 14:32:36 (INFO): File out_test.tif will be written in 2916 blocks of 205x205 pixels
Writing out_test.tif...: 100% [**************************************************] (10 seconds)
54.74user 6.27system 0:16.18elapsed 377%CPU (0avgtext+0avgdata 1889620maxresident)k
0inputs+235656outputs (0major+776377minor)pagefaults 0swaps
Configuration information
Linux standalone package OTB 6.6.1