question: public synchronized long allocate ( int length ) { int blocks = getBlockCount ( length ) ; BlockRange x = null ; for ( BlockRange b : freeSpace ) { if ( b . blocks >= blocks ) { x = b ; break ; } } long pos = getPos ( x . start ) ; if ( x . blocks == blocks ) { freeSpace . remove ( x ) ; } else { x . start += blocks ; x . blocks -= blocks ; } return pos ; }
target:  Allocate a number of blocks and mark them as used.