I don't get the GC. (heapSizeFactor followup)

FeepingCreature feepingcreature at gmail.com
Tue Jan 17 07:11:34 UTC 2023


On Tuesday, 17 January 2023 at 06:42:33 UTC, FeepingCreature 
wrote:
> Okay, queried GC stats instead of looking at RSS. Now I 
> randomly get 2.6GB after start without `heapSizeFactor`, 
> whatever, random variation. But the interesting thing is:
>
> - `heapSizeFactor=0.25`: usedSize 704MB freeSize 202MB
> - `heapSizeFactor=2` (default): usedSize 1568MB freeSize 810MB
>
> So why is twice as much GC memory *reachable* without 
> `heapSizeFactor`?

Okay hang on no.

If I actually call `GC.collect` before measuring, I do get the 
proper usedSize 652MB freeSize 2302MB. So the GC insists that it 
*transitively* needed 3GB? It seems the GC's claim is "because 
your program ran faster, it did something that ballooned its used 
memory to 3GB before it sank back down."   ... Right?

But that's impossible. This service is entirely network 
triggered. It can't use *more* live memory by running faster.

Could the GC's used-memory estimate have gotten messed up 
somehow/somewhere? I don't see where that could be in the code 
though.


More information about the Digitalmars-d mailing list