@UnstableApi
public interface Allocator

Known direct subclasses
DefaultAllocator

Default implementation of Allocator.


A source of allocations.

Summary

Nested types

public interface Allocator.AllocationNode

A node in a chain of Allocations.

Public methods

abstract Allocation

Obtain an Allocation.

abstract int

Returns the length of each individual Allocation.

abstract int

Returns the total number of bytes currently allocated.

abstract void
release(Allocation allocation)

Releases an Allocation back to the allocator.

abstract void

Releases all Allocations in the chain starting at the given .

abstract void

Hints to the allocator that it should make a best effort to release any excess Allocations.

Public methods

allocate

abstract Allocation allocate()

Obtain an Allocation.

When the caller has finished with the Allocation, it should be returned by calling release.

Returns
Allocation

The Allocation.

getIndividualAllocationLength

abstract int getIndividualAllocationLength()

Returns the length of each individual Allocation.

getTotalBytesAllocated

abstract int getTotalBytesAllocated()

Returns the total number of bytes currently allocated.

release

abstract void release(Allocation allocation)

Releases an Allocation back to the allocator.

Parameters
Allocation allocation

The Allocation being released.

release

abstract void release(Allocator.AllocationNode allocationNode)

Releases all Allocations in the chain starting at the given .

Implementations must not make memory allocations.

trim

abstract void trim()

Hints to the allocator that it should make a best effort to release any excess Allocations.