GSF.IO.Unmanaged.MemoryPoolPageList.CalculateMemoryPoolCeiling C# (CSharp) Method

CalculateMemoryPoolCeiling() private static method

Computes the ceiling of the buffer pool
private static CalculateMemoryPoolCeiling ( int memoryBlockSize, long systemTotalPhysicalMemory ) : long
memoryBlockSize int
systemTotalPhysicalMemory long
return long
        private static long CalculateMemoryPoolCeiling(int memoryBlockSize, long systemTotalPhysicalMemory)
        {
            long size = MemoryPool.MaximumTestedSupportedMemoryCeiling;

            //Physical upper limit is
            //the greater of 
            //  50% of memory
            //or
            //  all but 8GB of RAM
            long physicalUpperLimit = Math.Max(systemTotalPhysicalMemory / 2, systemTotalPhysicalMemory - 8 * 1024 * 1024 * 1024L);

            size = Math.Min(size, physicalUpperLimit);

            size = size - size % memoryBlockSize; //Rounds down to the nearest allocation size

            return size;
        }