Changeset 2210


Ignore:
Timestamp:
02/02/07 08:30:14 (13 years ago)
Author:
melissa
Message:

Fixed memory issue with file cache.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/RandomAccessStream.java

    r2200 r2210  
    179179    if (dis != null) dis.close(); 
    180180    dis = null; 
     181    buf = null; 
    181182    fileCache.put(this, Boolean.FALSE); 
    182183    openFiles--; 
     
    525526      dis = new DataInputStream(new BufferedInputStream( 
    526527        new FileInputStream(Location.getMappedId(file)), MAX_OVERHEAD)); 
     528      int len = (int) raf.length(); 
     529      buf = new byte[len < MAX_OVERHEAD ? len : MAX_OVERHEAD]; 
     530      raf.readFully(buf); 
     531      raf.seek(0); 
    527532    } 
    528533    else { 
     
    534539  } 
    535540 
    536   /** If we have too many open files, close 1/4 of them. */ 
     541  /** If we have too many open files, close most of them. */ 
    537542  private void cleanCache() { 
    538543    int toClose = MAX_FILES - 10; 
Note: See TracChangeset for help on using the changeset viewer.