int liveness = getLiveness(block, blockSize, SORT_FREE_BLOCKS); if (liveness == 0) freeBlock(block, sizeClass); else if (!LAZY_SWEEP) setFreeList(block, makeFreeListFromLiveBits(block, sizeClass)); else if (SORT_FREE_BLOCKS) addToBlockBucket(block, liveness);
if (maintainSideBitmap()) { int liveness = getLiveness(block, blockSize, SORT_FREE_BLOCKS); if (liveness == 0) freeBlock(block, sizeClass); else if (!LAZY_SWEEP) setFreeList(block, makeFreeListFromLiveBits(block, sizeClass)); else if (SORT_FREE_BLOCKS) addToBlockBucket(block, liveness); } else { boolean live = false; Address cursor = block; while(cursor.LT(block.plus(blockSize))) { live |= BlockAllocator.clearBlockMeta(cursor); cursor = cursor.plus(1 << BlockAllocator.LOG_MIN_BLOCK); } if (!live) { freeBlock(block, sizeClass); } }
  protected final void sweepBlocks() {    for (int sizeClass = 0; sizeClass < SIZE_CLASSES; sizeClass++) {      Address block = firstBlock.get(sizeClass);      clearBucketList();      Extent blockSize = Extent.fromIntSignExtend(BlockAllocator.blockSize(blockSizeClass[sizeClass]));      while (!block.isZero()) {        /* first check to see if block is completely free and if possible         * free the entire block */        Address next = BlockAllocator.getNextBlock(block);        int liveness = getLiveness(block, blockSize, SORT_FREE_BLOCKS);        if (liveness == 0)          freeBlock(block, sizeClass);        else if (!LAZY_SWEEP)          setFreeList(block, makeFreeListFromLiveBits(block, sizeClass));        else if (SORT_FREE_BLOCKS)          addToBlockBucket(block, liveness);        block = next;      }      if (SORT_FREE_BLOCKS) reestablishBlockFreeList(sizeClass);    }  }