4 ms·
If they used an array of structs they would've cut down on the GC's graph traversal significantly. Another option I was surprised they didn't mention was to ru
by iam 15y ago
If they used an array of structs they would've cut down on the GC's graph traversal significantly.
Another option I was surprised they didn't mention was to run GC.Collect periodically to clear out gen2.
- mrgoldenbrown 15y agoRunning Collect periodically probably won't help much in this scenario - the huge data structure isn't actually being collected during the GC.Collect. But the GC doesn't know this until it spikes the CPU while it walks a bajillion references. Since nothing is actually getting collected, if you ran GC.Collect periodically, you would just be incurring more lag with no benefit. I think your idea might help more in a different situation, one where you do have large amounts of memory getting reclaimed with each GC sweep.