docs/javadoc/reference/com/facebook/imagepipeline/memory/GenericByteArrayPool.html
|
|
Summary: Ctors | Methods | Protected Methods | Inherited Methods | [Expand All]
public class
extends BasePool<V>
implements ByteArrayPool
| java.lang.Object | | ↳ | com.facebook.imagepipeline.memory.BasePool<V> | | | ↳ | com.facebook.imagepipeline.memory.GenericByteArrayPool |
A pool of byte arrays. The pool manages a number of byte arrays of a predefined set of sizes. This set of sizes is typically, but not required to be, based on powers of 2. The pool supports a get/release paradigm. On a get request, the pool attempts to find an existing byte array whose size is at least as big as the requested size. On a release request, the pool adds the byte array to the appropriate bucket. This byte array can then be used for a subsequent get request.
| Public Constructors |
|---|
| Creates a new instance of the GenericByteArrayPool class |
| Public Methods |
|---|
| int |
| Gets the smallest buffer size supported by the pool |
| Protected Methods |
|---|
| byte[] |
| Allocate a buffer greater than or equal to the specified size |
| void |
| Frees the 'value' |
| int |
| Get the 'bucketed' size for the given request size. |
| int |
| Gets the bucketed size of the value |
| int |
| Gets the size in bytes for the given 'bucketed' size |
| [Expand] Inherited Methods | | --- | | From class com.facebook.imagepipeline.memory.BasePool
| abstract V | alloc(int bucketedSize) Allocates a new 'value' with the given size | | abstract void | free(V value) Frees the 'value' | | V | get(int size) Gets a new 'value' from the pool, if available. | | abstract int | getBucketedSize(int requestSize) Gets the bucketed size (typically something the same or larger than the requested size) | | abstract int | getBucketedSizeForValue(V value) Gets the bucketed size of the value | | abstract int | getSizeInBytes(int bucketedSize) Gets the size in bytes for the given bucketed size | | synchronized Map<String, Integer> | getStats() Export memory stats regarding buckets used, memory caps, reused values. | | synchronized V | getValue(Bucket<V> bucket) | | void | initialize() Finish pool initialization. | | boolean | isReusable(V value) Determines if the supplied value is 'reusable'. | | void | onParamsChanged() The pool parameters may have changed. | | void | release(V value) Releases the given value to the pool. | | void | trim(MemoryTrimType memoryTrimType) Trims the pool in response to low-memory states (invoked from MemoryManager) For now, we'll do the simplest thing, and simply clear out the entire pool. |
| | From class java.lang.Object
| Object | clone() | | boolean | equals(Object arg0) | | void | finalize() | | final Class<?> | getClass() | | int | hashCode() | | final void | notify() | | final void | notifyAll() | | String | toString() | | final void | wait(long arg0, int arg1) | | final void | wait(long arg0) | | final void | wait() |
| | From interface com.facebook.common.memory.MemoryTrimmable
| abstract void | trim(MemoryTrimType trimType) Trim memory. |
| | From interface com.facebook.common.memory.Pool
| 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. |
| | From interface com.facebook.common.references.ResourceReleaser
| abstract void | release(T value) Release the given value. |
|
Creates a new instance of the GenericByteArrayPool class
| memoryTrimmableRegistry | the memory manager to register with | | poolParams | provider for pool parameters |
Gets the smallest buffer size supported by the pool
Allocate a buffer greater than or equal to the specified size
| bucketedSize | size of the buffer requested |
Frees the 'value'
| value | the value to free |
Get the 'bucketed' size for the given request size. The 'bucketed' size is a size that is the same or larger than the request size. We walk through our list of pre-defined bucket sizes, and use that to determine the smallest bucket size that is larger than the requested size. If no such 'bucketedSize' is found, then we simply return "requestSize"
| requestSize | the logical request size |
| | if the requested size was invalid |
Gets the bucketed size of the value
| value | the value |
Gets the size in bytes for the given 'bucketed' size
| bucketedSize | the bucketed size |
+Generated by Doclava. +