FreeListManager { List<MemoryBlock> getAllocatedBlocks() { final List<MemoryBlock> value = new ArrayList<MemoryBlock>(); addBlocksFromChunks(getLiveChunks(), value); Collections.sort(value, new Comparator<MemoryBlock>() { @Override public int compare(MemoryBlock o1, MemoryBlock o2) { return Long.compare(o1.getAddress(), o2.getAddress()); } }); return value; } FreeListManager(MemoryAllocatorImpl ma, final Slab[] slabs); long getUsedMemory(); long getFreeMemory(); @SuppressWarnings("synthetic-access") OffHeapStoredObject allocate(int size); @SuppressWarnings("synthetic-access") void free(long addr); static final int TINY_MULTIPLE; static final int TINY_FREE_LIST_COUNT; static final int HUGE_MULTIPLE; static final int MAX_TINY; }
@Test public void allocatedBlocksEmptyIfNoAllocations() { Slab chunk = new SlabImpl(10); this.freeListManager = createFreeListManager(ma, new Slab[] {chunk}); List<MemoryBlock> ob = this.freeListManager.getAllocatedBlocks(); assertThat(ob).hasSize(0); }