Class LRUCacheAllocationStrategy
Allocation strategy that uses internal pools of objects to avoid allocations that can trigger GC calls.
Namespace: UnityEngine.ResourceManagement.Util
Syntax
public class LRUCacheAllocationStrategy : IAllocationStrategy
Constructors
LRUCacheAllocationStrategy(Int32, Int32, Int32, Int32)
Create a new LRUAllocationStrategy objct.
Declaration
public LRUCacheAllocationStrategy(int poolMaxSize, int poolCapacity, int poolCacheMaxSize, int initialPoolCacheCapacity)
Parameters
Type | Name | Description |
---|---|---|
Int32 | poolMaxSize | The max size of each pool. |
Int32 | poolCapacity | The initial capacity to create each pool list with. |
Int32 | poolCacheMaxSize | The max size of the internal pool cache. |
Int32 | initialPoolCacheCapacity | The initial number of pools to create. |
Methods
New(Type, Int32)
Create a new object of type t.
Declaration
public object New(Type type, int typeHash)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The type to return. |
Int32 | typeHash | The hash code of the type. |
Returns
Type | Description |
---|---|
Object | The new object. |
Implements
Release(Int32, Object)
Release an object.
Declaration
public void Release(int typeHash, object obj)
Parameters
Type | Name | Description |
---|---|---|
Int32 | typeHash | |
Object | obj | The object to release. |