I have a form with label that is updating by System.Windows.Forms.Timer control every 2 seconds. In task manager i see that memory usage is growing even if program is doing nothing(but label is still updating with latest info, that is memory usage for example) Example code for label text:
tlblRam.Text = string.Format("Ram: {0} MB", ConvertBytesToMegabytes(System.Diagnostics.Process.GetCurrentProcess().PrivateMemorySize64).ToString("0.00"));
But if i do force GC to collect the generations- it returns all the memory to some lower state. Also it is done automatically after ~5 minutes of inactive program's work. Does that mean that GC is waiting for its 2 gen cycle and only then collects all the strings that were tlblRam.Text's values?