src/SeqAn-1.2/seqan/file/string_external.h
// change the number of in-mem pageframes
// more pages mean less swapping, 
// less pages mean more free mem

change the number of in-mem pageframes
more pages mean less swapping,
less pages mean more free mem
change the number of in - mem pageframes more pages mean less swapping less pages mean more free mem
inline void resizeCache(unsigned newFrames) 
		{
            unsigned oldFrames = length(cache);
            if (data_size)
                newFrames = _min(newFrames, (unsigned) enclosingBlocks(data_size, (unsigned)PAGE_SIZE));
            if (newFrames < oldFrames) {
                flush(*this);
                for(unsigned i = newFrames; i < oldFrames; ++i) {
    			    int frameNo = cache.mruDirty();             
                    if (frameNo < 0) break;
				    TPageFrame &pf = cache[frameNo];
                    if (pf.begin) {
					    swapOutAndWait(pf);						
        				freePage(pf, file);                     
                    }
                    cache.erase(frameNo);                       
                    for(unsigned j = frameNo; j < length(cache); ++j)
                        rename(j);                              
                }
            } else if (oldFrames < newFrames) {
                resize(cache, newFrames);
            }
        }
inline void resizeCache ( unsigned newFrames ) { unsigned oldFrames = length ( cache ) ; if ( data_size ) newFrames = _min ( newFrames , ( unsigned ) enclosingBlocks ( data_size , ( unsigned ) PAGE_SIZE ) ) ; if ( newFrames < oldFrames ) { flush ( * this ) ; for ( unsigned i = newFrames ; i < oldFrames ; ++ i ) { int frameNo = cache . mruDirty ( ) ; if ( frameNo < 0 ) break ; TPageFrame & pf = cache [ frameNo ] ; if ( pf . begin ) { swapOutAndWait ( pf ) ; freePage ( pf , file ) ; } cache . erase ( frameNo ) ; for ( unsigned j = frameNo ; j < length ( cache ) ; ++ j ) rename ( j ) ; } } else if ( oldFrames < newFrames ) { resize ( cache , newFrames ) ; } }
change the number of in-mem pageframes
more pages mean less swapping,
less pages mean more free mem
change the number of in - mem pageframes more pages mean less swapping less pages mean more free mem
// get the most recently used frame (can be dirty)
 // *** frame is choosen ***
 // write synchronously to disk, if page is dirty
 // free memory
 // erase page frame from cache
 // update remaining pages
