Minimize GC memory footprint

frame frame86 at live.com
Sat Feb 6 17:50:18 UTC 2021


On Saturday, 6 February 2021 at 15:45:47 UTC, rikki cattermole 
wrote:

> The GC shouldn't be aware of the scope guard. It expands out 
> into a try finally block.

But .length = 0 should.

> Nah, this is old. It is also bad D code.
>
> Allocate up front and then set.

I agree but it has to work anyway. New users do not ask about how 
they can write friendly GC code.

> This will be significantly faster, as it won't require 
> allocating more than once and will prevent heap fragmentation 
> which 32bit is severely affected by (hence why precise GC is 
> important for testing on this target).

Ah, yes. I read about it in another thread. This is a specific 
problem for any GC that work on the same way, not only in D. But 
if it's a known problem, the default architecture should be 64bit 
where things just work. 32bit should be an opt-in then.

Default settings should work out of the box. If not - it's bad 
for reputation of the language.





More information about the Digitalmars-d-learn mailing list