public class

PoolParams

extends Object
java.lang.Object
   ↳ com.facebook.imagepipeline.memory.PoolParams

Class Overview

Config parameters for pools (BasePool. Supplied via a provider.

maxSizeSoftCap This represents a soft cap on the size of the pool. When the pool size hits this limit, the pool tries to trim its free space until either the pool size is below the soft cap, or the free space is zero. Note that allocations will not fail because we have exceeded the soft cap

maxSizeHardCap The hard cap represents a hard cap on the size of the pool. When the pool size exceeds this cap, allocations will start failing with a BasePool.PoolSizeViolationException

bucketSizes The pool can be configured with a set of 'sizes' - a bucket is created for each such size. Additionally, each bucket can have a a max-length specified, which is the sum of the used and free items in that bucket. As with the MaxSize parameter above, the maxLength here is a soft cap, in that it will not cause an exception on get; it simply controls the release path When the bucket sizes are specified upfront, the pool may still get requests for non standard sizes. Such cases are treated as plain alloc/free calls i.e. the values are not maintained in the pool. If this parameter is null, then the pool will create buckets on demand

minBucketSize This represents the minimum size of the buckets in the pool. This assures that all buckets can hold any element larger or equal to this size.

maxBucketSize This represents the maximum size of the buckets in the pool. This restricts all buckets to only accept elements smaller or equal to this size. If this size is exceeded, an exception will be thrown.

Summary

Constants
int IGNORE_THREADS If maxNumThreads is set to this level, the pool doesn't actually care what it is
Fields
public String bitmapPoolType
public final SparseIntArray bucketSizes
public boolean fixBucketsReinitialization
public final int maxBucketSize
public final int maxNumThreads The maximum number of threads that may be accessing this pool.
public final int maxSizeHardCap
public final int maxSizeSoftCap
public final int minBucketSize
Public Constructors
PoolParams(int maxSize, SparseIntArray bucketSizes)
Set up pool params
PoolParams(int maxSizeSoftCap, int maxSizeHardCap, SparseIntArray bucketSizes)
Set up pool params
PoolParams(int maxSizeSoftCap, int maxSizeHardCap, SparseIntArray bucketSizes, int minBucketSize, int maxBucketSize, int maxNumThreads)
Set up pool params
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int IGNORE_THREADS

If maxNumThreads is set to this level, the pool doesn't actually care what it is

Constant Value: -1 (0xffffffff)

Fields

public String bitmapPoolType

public final SparseIntArray bucketSizes

public boolean fixBucketsReinitialization

public final int maxBucketSize

public final int maxNumThreads

The maximum number of threads that may be accessing this pool.

Pool implementations may or may not need this to be set.

public final int maxSizeHardCap

public final int maxSizeSoftCap

public final int minBucketSize

Public Constructors

public PoolParams (int maxSize, SparseIntArray bucketSizes)

Set up pool params

Parameters
maxSize soft-cap and hard-cap on size of the pool
bucketSizes (optional) bucket sizes and lengths for the pool

public PoolParams (int maxSizeSoftCap, int maxSizeHardCap, SparseIntArray bucketSizes)

Set up pool params

Parameters
maxSizeSoftCap soft cap on max size of the pool
maxSizeHardCap hard cap on max size of the pool
bucketSizes (optional) bucket sizes and lengths for the pool

public PoolParams (int maxSizeSoftCap, int maxSizeHardCap, SparseIntArray bucketSizes, int minBucketSize, int maxBucketSize, int maxNumThreads)

Set up pool params

Parameters
maxSizeSoftCap soft cap on max size of the pool
maxSizeHardCap hard cap on max size of the pool
bucketSizes (optional) bucket sizes and lengths for the pool
minBucketSize min bucket size for the pool
maxBucketSize max bucket size for the pool
maxNumThreads the maximum number of threads in the pool, or -1 if the pool doesn't care