Amphibian.Debug.MemoryTracker.Update C# (CSharp) Method

Update() public method

public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
return void
        public override void Update(GameTime gameTime)
        {
            if (stopwatch.Elapsed > SampleSpan) {
                stopwatch.Reset();
                stopwatch.Start();

                long heapSize = GC.GetTotalMemory(false);
                ManagedHeapDelta = heapSize - ManagedHeapSize;
                ManagedHeapSize = heapSize;

                if (garbageTracker.Target == null) {
                    garbageTracker.Target = new object();
                    Collections++;
                }

                // Update draw string.
                stringBuilder.Length = 0;
                stringBuilder.Append("Heap: ");
                stringBuilder.AppendNumber((int)(ManagedHeapSize / 1024));
                stringBuilder.Append("K");
                stringBuilder.AppendLine();
                stringBuilder.Append("Delta: ");
                stringBuilder.AppendNumber((float)(ManagedHeapDelta / 1024f), 1, AppendNumberOptions.None);
                stringBuilder.Append("K");
                stringBuilder.AppendLine();
                stringBuilder.Append("Collections: ");
                stringBuilder.AppendNumber(Collections);
            }
        }