There may be no answer to this.
Profiling some code, and I noticed that Gen1 Heap Size is 250MB, then after a single Gen0 collection, it goes up to 518MB. So Gen0 got to 250MB before collecting.
I was always under the impression that Gen0 and Gen1 (though they aren't fixed and can vary) were much much smaller than that.
Is there anything we can say about the expected range of sizes for various generations?
(This is under Workstation GC on a machine with 8GB Ram, .Net 4.5.2. We're actually measuring the code under MSTest / QTAgent, which presumably affects how GC is performed)
Best How To :
I searched a bit and found many claims regarding the initial size of each generation but each of them claim different numbers. It's safe to assume that it starts low and changes in size based on allocations and collections. But you already know this.
There's nothing like a "normal" generation size. If you allocate many small objects and do not keep them alive too long, Gen0 stays low in size and collections occur more often but are blazingly fast. However, if you allocate less object but larger in size, Gen0 size will probably grow and collections will occur less often.
There's not many situations where you should be concerned about these numbers anyway. If you want to analyze how these generations change their size, run something like DotTrace and watch what preceded increases in size and maybe you will be able to tell what method/chain of calls/... caused it.