@ -7,22 +7,36 @@
{
/// <summary>
/// The default value for: maximum size of pooled arrays in bytes.
/// Currently set to 3 2MB, which is equivalent to 8 megapixels of raw <see cref="Rgba32"/> data.
/// Currently set to 24 MB, which is equivalent to 8 megapixels of raw <see cref="Rgba32"/> data.
/// </summary>
internal const int DefaultMaxPooledBufferSizeInBytes = 3 2 * 1 0 2 4 * 1 0 2 4 ;
internal const int DefaultMaxPooledBufferSizeInBytes = 2 4 * 1 0 2 4 * 1 0 2 4 ;
/// <summary>
/// The value for: The threshold to pool arrays in <see cref="largeArrayPool"/> which has less buckets for memory safety.
/// </summary>
private const int DefaultBufferSelectorThresholdInBytes = 8 * 1 0 2 4 * 1 0 2 4 ;
/// <summary>
/// The default bucket count for <see cref="largeArrayPool"/>.
/// </summary>
private const int DefaultLargePoolBucketCount = 6 ;
/// <summary>
/// The default bucket count for <see cref="normalArrayPool"/>.
/// </summary>
private const int DefaultNormalPoolBucketCount = 1 6 ;
/// <summary>
/// This is the default. Should be good for most use cases.
/// </summary>
/// <returns>The memory manager</returns>
public static ArrayPoolMemoryManager CreateWithNormalPooling ( )
public static ArrayPoolMemoryManager CreateDefault ( )
{
return new ArrayPoolMemoryManager ( DefaultMaxPooledBufferSizeInBytes , DefaultBufferSelectorThresholdInBytes , 8 , 2 4 ) ;
return new ArrayPoolMemoryManager (
DefaultMaxPooledBufferSizeInBytes ,
DefaultBufferSelectorThresholdInBytes ,
DefaultLargePoolBucketCount ,
DefaultNormalPoolBucketCount ) ;
}
/// <summary>
@ -31,7 +45,16 @@
/// <returns>The memory manager</returns>
public static ArrayPoolMemoryManager CreateWithModeratePooling ( )
{
return new ArrayPoolMemoryManager ( 1 0 2 4 * 1 0 2 4 , 1 0 2 4 * 1 6 , 1 6 , 2 4 ) ;
return new ArrayPoolMemoryManager ( 1 0 2 4 * 1 0 2 4 , 3 2 * 1 0 2 4 , 1 6 , 2 4 ) ;
}
/// <summary>
/// Only pool small buffers like image rows.
/// </summary>
/// <returns>The memory manager</returns>
public static ArrayPoolMemoryManager CreateWithMinimalPooling ( )
{
return new ArrayPoolMemoryManager ( 6 4 * 1 0 2 4 , 3 2 * 1 0 2 4 , 8 , 2 4 ) ;
}
/// <summary>