java.lang.Object | ||
↳ | com.facebook.imagepipeline.memory.BasePool<V> | |
↳ | com.facebook.imagepipeline.memory.NativeMemoryChunkPool |
Manages a pool of native memory chunks (NativeMemoryChunk
)
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
NativeMemoryChunkPool(MemoryTrimmableRegistry memoryTrimmableRegistry, PoolParams poolParams, PoolStatsTracker nativeMemoryChunkPoolStatsTracker)
Creates a new instance of the NativeMemoryChunkPool class
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int |
getMinBufferSize()
Gets the smallest size supported by the pool
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
NativeMemoryChunk |
alloc(int bucketedSize)
Allocate a native memory chunk larger than or equal to the specified size
| ||||||||||
void |
free(NativeMemoryChunk value)
Frees the 'value'
| ||||||||||
int |
getBucketedSize(int requestSize)
Get the 'bucketed' size for the given request size.
| ||||||||||
int |
getBucketedSizeForValue(NativeMemoryChunk value)
Gets the bucketed size of the value
| ||||||||||
int |
getSizeInBytes(int bucketedSize)
Gets the size in bytes for the given 'bucketed' size
| ||||||||||
boolean |
isReusable(NativeMemoryChunk value)
Checks if the value is reusable (for subseequent
get(int) operations. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
Creates a new instance of the NativeMemoryChunkPool class
memoryTrimmableRegistry | the memory manager to register with |
---|---|
poolParams | provider for pool parameters |
Gets the smallest size supported by the pool
Allocate a native memory chunk larger than or equal to the specified size
bucketedSize | size of the buffer requested |
---|
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 |
---|
Checks if the value is reusable (for subseequent get(int)
operations.
The value is reusable, if
- it hasn't already been freed
value | the value to test for reusability |
---|