public abstract class

MemoryChunkPool

extends BasePool<V>
java.lang.Object
   ↳ com.facebook.imagepipeline.memory.BasePool<V>
     ↳ com.facebook.imagepipeline.memory.MemoryChunkPool
Known Direct Subclasses

Class Overview

Manages a pool of memory chunks (MemoryChunk)

Summary

Protected Methods
abstract MemoryChunk alloc(int bucketedSize)
Allocates a new 'value' with the given size
void free(MemoryChunk value)
Frees the 'value'
int getBucketedSize(int requestSize)
Gets the bucketed size (typically something the same or larger than the requested size)
int getBucketedSizeForValue(MemoryChunk value)
Gets the bucketed size of the value
int getSizeInBytes(int bucketedSize)
Gets the size in bytes for the given bucketed size
boolean isReusable(MemoryChunk value)
Determines if the supplied value is 'reusable'.
[Expand]
Inherited Methods
From class com.facebook.imagepipeline.memory.BasePool
From class java.lang.Object
From interface com.facebook.common.memory.MemoryTrimmable
From interface com.facebook.common.memory.Pool
From interface com.facebook.common.references.ResourceReleaser

Protected Methods

protected abstract MemoryChunk alloc (int bucketedSize)

Allocates a new 'value' with the given size

Parameters
bucketedSize the logical size to allocate
Returns
  • a new value

protected void free (MemoryChunk value)

Frees the 'value'

Parameters
value the value to free

protected int getBucketedSize (int requestSize)

Gets the bucketed size (typically something the same or larger than the requested size)

Parameters
requestSize the logical request size
Returns
  • the 'bucketed' size

protected int getBucketedSizeForValue (MemoryChunk value)

Gets the bucketed size of the value

Parameters
value the value
Returns
  • bucketed size of the value

protected int getSizeInBytes (int bucketedSize)

Gets the size in bytes for the given bucketed size

Parameters
bucketedSize the bucketed size
Returns
  • size in bytes

protected boolean isReusable (MemoryChunk value)

Determines if the supplied value is 'reusable'. This is called during release(Object), and determines if the value can be added to the freelists of the pool (for future reuse), or must be released right away. Subclasses can override this to provide custom implementations

Parameters
value the value to test for reusability
Returns
  • true if the value is reusable