Changeset 6056


Ignore:
Timestamp:
03/22/10 07:36:41 (10 years ago)
Author:
callan
Message:

Performing the NIO out of memory exception handling in the try block to not murder performance.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/common/src/loci/common/NIOFileHandle.java

    r6053 r6056  
    475475      offset = bufferStartPosition; 
    476476      ByteOrder byteOrder = buffer == null ? order : getOrder(); 
    477       buffer = channel.map(mapMode, bufferStartPosition, newSize); 
     477      try { 
     478        buffer = channel.map(mapMode, bufferStartPosition, newSize); 
     479      } catch (IOException e) { 
     480        // see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5092131 and 
     481        //     http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6417205 
     482        // for an explanation of why the following is necessary 
     483        // This is not a problem with JDK 1.6 and higher but can be a 
     484        // problem with earlier JVMs. 
     485        System.gc(); 
     486        System.runFinalization(); 
     487        buffer = channel.map(mapMode, bufferStartPosition, newSize); 
     488      } 
    478489      if (byteOrder != null) setOrder(byteOrder); 
    479       // see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5092131 
    480       // for an explanation of why the following is necessary 
    481       System.gc(); 
    482       System.runFinalization(); 
     490      //System.gc(); 
     491      //System.runFinalization(); 
    483492    } 
    484493    buffer.position((int) (offset - bufferStartPosition)); 
Note: See TracChangeset for help on using the changeset viewer.