com.facebook.common.memory.Pool<V> |
Known Indirect Subclasses |
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)
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract V |
get(int size)
Gets a 'value' of size 'S' (or larger) from the pool, if available.
| ||||||||||
abstract void |
release(V value)
Releases the given value to the pool.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.facebook.common.memory.MemoryTrimmable
| |||||||||||
From interface
com.facebook.common.references.ResourceReleaser
|
Gets a 'value' of size 'S' (or larger) from the pool, if available. Allocates a new value if necessary.
size | the logical size to allocate |
---|
Releases the given value to the pool. The pool may decide to - reuse the value (for future
get(int)
operations OR - 'free' the value
value | the value to release to the pool |
---|