Interface Allocator
-
- All Known Implementing Classes:
DefaultAllocator
public interface Allocator
A source of allocations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Allocator.AllocationNode
A node in a chain ofAllocations
.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Allocation
allocate()
Obtain anAllocation
.int
getIndividualAllocationLength()
Returns the length of each individualAllocation
.int
getTotalBytesAllocated()
Returns the total number of bytes currently allocated.void
release(Allocation allocation)
Releases anAllocation
back to the allocator.void
release(Allocator.AllocationNode allocationNode)
Releases allAllocations
in the chain starting at the givenAllocator.AllocationNode
.void
trim()
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 anAllocation
back to the allocator.- Parameters:
allocation
- TheAllocation
being released.
-
release
void release(Allocator.AllocationNode allocationNode)
Releases allAllocations
in the chain starting at the givenAllocator.AllocationNode
.Implementations must not make memory allocations.
-
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
.
-
-