@UnstableApi
interface Allocator

Known direct subclasses
DefaultAllocator

Default implementation of Allocator.


A source of allocations.

Summary

Nested types

A node in a chain of Allocations.

Public functions

Allocation!

Obtain an Allocation.

Int

Returns the length of each individual Allocation.

Int

Returns the total number of bytes currently allocated.

Unit
release(allocation: Allocation!)

Releases an Allocation back to the allocator.

Unit

Releases all Allocations in the chain starting at the given .

Unit

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

Public functions

allocate

fun allocate(): Allocation!

Obtain an Allocation.

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

Returns
Allocation!

The Allocation.

getIndividualAllocationLength

fun getIndividualAllocationLength(): Int

Returns the length of each individual Allocation.

getTotalBytesAllocated

fun getTotalBytesAllocated(): Int

Returns the total number of bytes currently allocated.

release

fun release(allocation: Allocation!): Unit

Releases an Allocation back to the allocator.

Parameters
allocation: Allocation!

The Allocation being released.

release

fun release(allocationNode: Allocator.AllocationNode!): Unit

Releases all Allocations in the chain starting at the given .

Implementations must not make memory allocations.

trim

fun trim(): Unit

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