Back to Fresco

Pool

docs/javadoc/reference/com/facebook/common/memory/Pool.html

3.6.015.2 KB
Original Source

Fresco

|

|

Packages | Classes

Interfaces

Classes

Enums

Exceptions

Packages | Classes

Summary: Methods | Inherited Methods | [Expand All]

public interface

Pool

implements MemoryTrimmableResourceReleaser<T>

| com.facebook.common.memory.Pool<V> |

| Known Indirect Subclasses

AshmemMemoryChunkPool, BasePool<V>, BitmapPool, BucketsBitmapPool, BufferMemoryChunkPool, ByteArrayPool, DummyBitmapPool, DummyTrackingInUseBitmapPool, GenericByteArrayPool, LruBitmapPool, MemoryChunkPool, NativeMemoryChunkPool

| AshmemMemoryChunkPool | Manages a pool of ashmem memory chunks (AshmemMemoryChunk) | | BasePool<V> | A base pool class that manages a pool of values (of type V). | | BitmapPool | | | BucketsBitmapPool | Manages a pool of bitmaps. | | BufferMemoryChunkPool | Manages a pool of buffer memory chunks (BufferMemoryChunk) | | ByteArrayPool | A pool of byte-arrays | | DummyBitmapPool | | | DummyTrackingInUseBitmapPool | | | GenericByteArrayPool | A pool of byte arrays. | | LruBitmapPool | | | MemoryChunkPool | Manages a pool of memory chunks (MemoryChunk) | | NativeMemoryChunkPool | Manages a pool of native memory chunks (NativeMemoryChunk) |

|

Class Overview

Manages a pool of reusable values of type V. The sizes of the values are described by the type S The pool supports two main operations #get(Object) - returns a value of size that's the same or larger than the requested size release(Object) - releases the value to the pool

In addition, the pool subscribes to the memory manager, and responds to low-memory events via calls to trim(MemoryTrimType). Some percent (perhaps all) of the values in the pool are then 'freed'.

Known implementations: BasePool (GenericByteArrayPool, SingleByteArrayPool, BitmapPool)

Summary

Public Methods
abstract V
Gets a 'value' of size 'S' (or larger) from the pool, if available.
abstract void
Releases the given value to the pool.

| [Expand] Inherited Methods | | --- | | From interface com.facebook.common.memory.MemoryTrimmable

| abstract void | trim(MemoryTrimType trimType) Trim memory. |

| | From interface com.facebook.common.references.ResourceReleaser

| abstract void | release(T value) Release the given value. |

|

Public Methods

public abstract V get(int size)

Gets a 'value' of size 'S' (or larger) from the pool, if available. Allocates a new value if necessary.

Parameters

| size | the logical size to allocate |

Returns
  • a new value

public abstract void release(V value)

Releases the given value to the pool. The pool may decide to - reuse the value (for future get(int) operations OR - 'free' the value

Parameters

| value | the value to release to the pool |

+Generated by Doclava. +