NoFreeMemoryManager implements MemoryManager { @Override public void allocate(Slice s, int size) { boolean allocated = allocator.allocate(s, size); assert allocated; } NoFreeMemoryManager(BlockMemoryAllocator memoryAllocator); void close(); long allocated(); @Override void allocate(Slice s, int size); @Override void release(Slice s); boolean isClosed(); @Override boolean decodeReference(Slice s, long reference); @Override long encodeReference(Slice s); @Override long alterReferenceForDelete(long reference); @Override long getInvalidReference(); @Override boolean isReferenceValid(long reference); @Override boolean isReferenceDeleted(long reference); @Override boolean isReferenceConsistent(long reference);  }
@Test public void allocate() { Slice s = new Slice(); ByteBuffer bb; noFreeMemoryManager.allocate(s, 4); Assert.assertEquals(4, s.getAllocatedLength()); Assert.assertEquals(4, noFreeMemoryManager.allocated()); noFreeMemoryManager.allocate(s, 4); Assert.assertEquals(4, s.getAllocatedLength()); Assert.assertEquals(8, noFreeMemoryManager.allocated()); }