예제 #1
0
 /**
  * Free a block with the offset
  *
  * @param offset block's offset
  * @return size freed
  */
 public synchronized int freeBlock(long offset) {
   int bucketNo = (int) (offset / bucketCapacity);
   assert bucketNo >= 0 && bucketNo < buckets.length;
   Bucket targetBucket = buckets[bucketNo];
   bucketSizeInfos[targetBucket.sizeIndex()].freeBlock(targetBucket, offset);
   usedSize -= targetBucket.getItemAllocationSize();
   return targetBucket.getItemAllocationSize();
 }
예제 #2
0
 public String toString() {
   StringBuilder sb = new StringBuilder(1024);
   for (int i = 0; i < buckets.length; ++i) {
     Bucket b = buckets[i];
     if (i > 0) sb.append(", ");
     sb.append("bucket.").append(i).append(": size=").append(b.getItemAllocationSize());
     sb.append(", freeCount=").append(b.freeCount()).append(", used=").append(b.usedCount());
   }
   return sb.toString();
 }
예제 #3
0
 public int sizeOfAllocation(long offset) {
   int bucketNo = (int) (offset / bucketCapacity);
   assert bucketNo >= 0 && bucketNo < buckets.length;
   Bucket targetBucket = buckets[bucketNo];
   return targetBucket.getItemAllocationSize();
 }