GC performance: collection frequency

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 14 11:58:43 PDT 2015


On Monday, 14 September 2015 at 18:51:36 UTC, H. S. Teoh wrote:
> We could also reduce the default collection frequency, of 
> course, but lacking sufficient data I wouldn't know what value 
> to set it to.

Definitely. I think it hits a case where it is right at the edge 
of the line and you are allocating a small amount.

So it is like the limit is 1,000 bytes. You are at 980 and ask it 
to allocate 30. So it runs a collection cycle, frees the 30 from 
the previous loop iteration, then allocates it again... so the 
whole loop, it is on the edge and runs very often.

Of course, it has to scan everything to ensure it is safe to free 
those 30 bytes so the GC then runs way out of proportion.

Maybe we can make the GC detect this somehow and bump up the 
size. I don't actually know the implementation that well though.


More information about the Digitalmars-d mailing list