Interface Allocator
-
- All Superinterfaces:
AutoCloseable,Closeable
public interface Allocator extends Closeable
Implementations are responsible for allocate space.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longallocate(int size)Allocate space with the given size.voidfree(long address)Free the space with the given address.ChunkgetChunkById(int chunkId)Returns the chunk with the given chunk id.
-
-
-
Method Detail
-
allocate
long allocate(int size) throws ExceptionAllocate space with the given size.- Parameters:
size- size of space to allocate.- Returns:
- address of the allocated space.
- Throws:
Exception- This method will throw exception if failed to allocate space.
-
free
void free(long address)
Free the space with the given address.- Parameters:
address- address of the space to free.
-
getChunkById
Chunk getChunkById(int chunkId)
Returns the chunk with the given chunk id.- Parameters:
chunkId- id of the chunk.- Returns:
- chunk with the given id.
-
-