src/main/java/org/nustaq/offheap/FSTBinaryOffheapMap.java
public void resizeStore(long required, long maxgrowbytes) {
        if ( mappedFile == null )
            throw new RuntimeException("store is full. Required: "+required);
        if ( required <= memory.length() )
            return;
        mutationCount++;
        System.out.println("resizing underlying "+mappedFile+" to "+required+" numElem:"+numElem);
        long tim = System.currentTimeMillis();
        ((MMFBytez) memory).freeAndClose();
        memory = null;
        try {
            File mf = new File(mappedFile);
            FileOutputStream f = new FileOutputStream(mf,true);
            long len = mf.length();
            required = required + Math.min(required,maxgrowbytes);
            byte[] toWrite = new byte[1000];
            long max = (required - len)/1000;
            for ( long i = 0; i < max+2; i++ ) {
                f.write(toWrite);
            }
            f.flush();
            f.close();
            resetMem(mappedFile, mf.length());
            System.out.println("resizing done in "+(System.currentTimeMillis()-tim)+" numElemAfter:"+numElem);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
public void resizeStore(long required, long maxgrowbytes) {
        if ( mappedFile == null )
            throw new RuntimeException("store is full. Required: "+required);
        if ( required <= memory.length() )
            return;
        mutationCount++;
        System.out.println("resizing underlying "+mappedFile+" to "+required+" numElem:"+numElem);
        long tim = System.currentTimeMillis();
        ((MMFBytez) memory).freeAndClose();
        memory = null;
        try {
            File mf = new File(mappedFile);
            FileOutputStream f = new FileOutputStream(mf,true);
            long len = mf.length();
            required = required + Math.min(required,maxgrowbytes);
            byte[] toWrite = new byte[1000];
            long max = (required - len)/1000;
            for ( long i = 0; i < max+2; i++ ) {
                f.write(toWrite);
            }
            f.flush();
            f.close();
            resetMem(mappedFile, mf.length());
            System.out.println("resizing done in "+(System.currentTimeMillis()-tim)+" numElemAfter:"+numElem);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
public void resizeStore ( long required , long maxgrowbytes ) { if ( mappedFile == null ) throw new RuntimeException ( "store is full. Required: " + required ) ; if ( required <= memory . length ( ) ) return ; mutationCount ++ ; System . out . println ( "resizing underlying " + mappedFile + " to " + required + " numElem:" + numElem ) ; long tim = System . currentTimeMillis ( ) ; ( ( MMFBytez ) memory ) . freeAndClose ( ) ; memory = null ; try { File mf = new File ( mappedFile ) ; FileOutputStream f = new FileOutputStream ( mf , true ) ; long len = mf . length ( ) ; required = required + Math . min ( required , maxgrowbytes ) ; byte [ ] toWrite = new byte [ 1000 ] ; long max = ( required - len ) / 1000 ; for ( long i = 0 ; i < max + 2 ; i ++ ) { f . write ( toWrite ) ; } f . flush ( ) ; f . close ( ) ; resetMem ( mappedFile , mf . length ( ) ) ; System . out . println ( "resizing done in " + ( System . currentTimeMillis ( ) - tim ) + " numElemAfter:" + numElem ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } }
PRIVILEGED method. You gotta know what your doing here ..

currently a very expensive operation .. frees everything, resize file and remap.
Remapping involves rebuild of index.
@param required
PRIVILEGED method . You gotta know what your doing here ..