You can check the memory usage of any process:
If it reaches a certain size you can dispose of unwanted objects and call garbage collection.
System.Diagnostics.Process p = System.Diagnostics.Process.GetCurrentProcess();
long memory = p.PrivateMemorySize64;
if(memory > 500 * 1024 * 1024)
{
GC.Collect();
}
Although from my experience
GC.Collect()
doesn't always work when you ask it too. The process memory may keep growing until the framework decides it need to free up some space.