title: Matlab - Blockproc/tifflib failing while writing big tiff File
body: <p>In Matlab I use blockproc to process a big (geo) tiff file (in the order of 10Gb) containing only one band of 32bit float data.</p>
  
  <p>My problem now is that blockproc, or more specific tifflib, suddenly fails to write a tile. This is independant from the inputfile, Harddrive/file location, or other parameters, such as processing, Matlab version, and even OS.</p>
  
  <p>And it's usually always around the same tilenumber (#3372for linux, #3176 for Windows 10).</p>
  
  <p>But blockproc runs through when using a smaller version of the large files (~around 4Gb instead of 10Gb).</p>
  
  <p>This is the error message I get (Debian 64bit, Matlab 2014b):</p>
  
  <pre><code>Warning: The following error was caught while executing 'images.internal.TileHandle'
  class destructor:
  Unable to write tile #3684.
  &gt; In TileCache&gt;TileCache.setTile at 71
    In TiffAdapter&gt;TiffAdapter.getTileHandle at 560
    In TiffAdapter&gt;TiffAdapter.writeRegion at 354
    In blockproc&gt;putBlock at 879
    In blockproc&gt;serialLoop at 459
    In blockproc at 340
    In removeEGM at 13
  Warning: The following error was caught while executing 'images.internal.TileHandle'
  class destructor:
  Unable to write tile #3685.
  &gt; In TileCache&gt;TileCache.setTile at 71
    In TiffAdapter&gt;TiffAdapter.getTileHandle at 560
    In TiffAdapter&gt;TiffAdapter.writeRegion at 354
    In blockproc&gt;putBlock at 879
    In blockproc&gt;serialLoop at 459
    In blockproc at 340
    In removeEGM at 13
  Warning: The following error was caught while executing 'images.internal.TileHandle'
  class destructor:
  Unable to write tile #3686.
  &gt; In TileCache&gt;TileCache.setTile at 71
    In TiffAdapter&gt;TiffAdapter.getTileHandle at 560
    In TiffAdapter&gt;TiffAdapter.writeRegion at 354
    In blockproc&gt;putBlock at 879
    In blockproc&gt;serialLoop at 459
    In blockproc at 340
    In removeEGM at 13
  Warning: The following error was caught while executing 'images.internal.TileHandle'
  class destructor:
  Unable to write tile #3687.
  &gt; In TileCache&gt;TileCache.setTile at 71
    In TiffAdapter&gt;TiffAdapter.getTileHandle at 560
    In TiffAdapter&gt;TiffAdapter.writeRegion at 354
    In blockproc&gt;putBlock at 879
    In blockproc&gt;serialLoop at 459
    In blockproc at 340
    In removeEGM at 13
  Error using tifflib
  Unable to write tile #3372.
  
  Error in Tiff/writeEncodedTile (line 1602)
  tifflib('writeEncodedTile',obj.FileID,tileNumber-1,varargin{:});
  
  Error in images.internal.TiffAdapter/writeBlock (line 420)
                  obj.TiffObj.writeEncodedTile(blockId, block);
  
  Error in images.internal.TiffAdapter/writeRegion (line 377)
                          obj.writeBlock(blockId, data(ry - start(1) + 1, ...
  
  Error in blockproc&gt;putBlock (line 879)
  dest.writeRegion(start_loc,...
  
  Error in blockproc/serialLoop (line 459)
  putBlock(options.Destination,row,col,output_block,output_size);
  
  Error in blockproc (line 340)
      serialLoop();
  
  Error in removeEGM (line 13)
  blockproc(in_dem, [3000, 3000], my_fun, 'Destination', out_dem);
  </code></pre>