code: public synchronized boolean freeSegment(Segment seg) throws IOException {
          if (seg == null)
              return false;
  
          int segId = seg.getSegmentId();
          if (segId < _segList.size() && _segList.get(segId) == seg) {
              _segList.set(segId, null);
              seg.close(false);
              
              if(segId == (_segList.size() - 1)) {
                  try {
                      // Delete last segment.
                      _segList.remove(segId);
                      
                      File segFile = seg.getSegmentFile();
                      if(segFile.exists()) segFile.delete();
                      
                      File sibFile = getSegmentIndexBufferFile(segId);
                      if(sibFile.exists()) sibFile.delete();
                      
                      _log.info("Segment " + seg.getSegmentId() + " deleted");
                  } catch(Exception e) {
                      _log.warn("Segment " + seg.getSegmentId() + " not deleted", e);
                  }
              } else {
                  if (seg.isRecyclable() && recycle(seg)) {
                      _log.info("Segment " + seg.getSegmentId() + " recycled");
                  } else {
                      _log.info("Segment " + seg.getSegmentId() + " freed");
                  }
              }
              
              return true;
          }
          
          return false;
      }
docs: Frees the specified segment.