Interface Allocator
-
- All Known Implementing Classes:
DefaultAllocator
public interface AllocatorA source of allocations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Allocationallocate()Obtain anAllocation.intgetIndividualAllocationLength()Returns the length of each individualAllocation.intgetTotalBytesAllocated()Returns the total number of bytes currently allocated.voidrelease(Allocation allocation)Releases anAllocationback to the allocator.voidrelease(Allocation[] allocations)Releases an array ofAllocations back to the allocator.voidtrim()Hints to the allocator that it should make a best effort to release any excessAllocations.
-
-
-
Method Detail
-
allocate
Allocation allocate()
Obtain anAllocation.When the caller has finished with the
Allocation, it should be returned by callingrelease(Allocation).- Returns:
- The
Allocation.
-
release
void release(Allocation allocation)
Releases anAllocationback to the allocator.- Parameters:
allocation- TheAllocationbeing released.
-
release
void release(Allocation[] allocations)
Releases an array ofAllocations back to the allocator.- Parameters:
allocations- The array ofAllocations being released.
-
trim
void trim()
Hints to the allocator that it should make a best effort to release any excessAllocations.
-
getTotalBytesAllocated
int getTotalBytesAllocated()
Returns the total number of bytes currently allocated.
-
getIndividualAllocationLength
int getIndividualAllocationLength()
Returns the length of each individualAllocation.
-
-