// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Collections; using System.Diagnostics; namespace E { class MainClass { public static void PrintMemoryStatus() { Console.WriteLine("Application has allocated from .NET " + GC.GetTotalMemory(false)/1000000 + " MB"); Console.WriteLine(".NET has allocated from Windows " + Process.GetCurrentProcess().PrivateMemorySize/1000000 + " MB"); } public static void Main(string[] args) { PrintMemoryStatus(); ArrayList al1 = new ArrayList(1000000); PrintMemoryStatus(); ArrayList al2 = new ArrayList(1000000); PrintMemoryStatus(); } } }