Have you ever wondered how applications know how much memory to use, how is that memory distributed or who cleans up memory? All those operations are executed by the Garbage Collector.
What triggers Garbage collector?
- Your system is low on physical memory. Meaning your system has used up almost all of your RAM memory and will start to use page file.
- The memory that is used by allocated objects on the managed heap surpasses an acceptable threshold. This threshold is continuously adjusted as the process runs.
- Application is written to call the GC.Collect method.