// Total System Memory Used
            void UpdateMaxSystemUsedMemory(long firstFrameToCheck, long lastFrameToCheck)
            {
                s_UpdateMaxSystemUsedMemoryProfilerMarker.Begin();
                var frameCountToCheck = lastFrameToCheck - firstFrameToCheck;

                m_MaxSystemUsedMemory = 0;
                var max = m_MaxSystemUsedMemory;

                // try to reuse the array if possible
                if (m_CachedArray == null || m_CachedArray.Length != frameCountToCheck)
                {
                    m_CachedArray = new float[frameCountToCheck];
                }
                float maxValueInRange;

                ProfilerDriver.GetCounterValuesBatch(UnityEngine.Profiling.ProfilerArea.Memory, "System Used Memory", (int)firstFrameToCheck, 1, m_CachedArray, out maxValueInRange);
                if (maxValueInRange > max)
                {
                    max = (ulong)maxValueInRange;
                }
                m_MaxSystemUsedMemory = max;
                s_UpdateMaxSystemUsedMemoryProfilerMarker.End();
            }