Why does this simple test program leak 500MB of RAM?

FeepingCreature feepingcreature at gmail.com
Mon Jun 19 16:40:34 UTC 2023


On Monday, 19 June 2023 at 15:59:39 UTC, Steven Schveighoffer 
wrote:
> On 6/19/23 6:15 AM, FeepingCreature wrote:
>> If I alloca 10KB of stack at the beginning of the recursion, 
>> the residential RAM drops to ~180MB. I don't think this 
>> completely solves the issue, but it sure is interesting.
>> 
>
> That is interesting...

Some additional info I probably should have mentioned.

Note that I'm manually calling the GC at the end. At that point, 
everything should be dead. heaptrack shows that we get something 
like 8 big GC runs over the program runtime: as expected, because 
it's overprovisioning a "healthy" amount.

My standing theory is that it's the zombie stack issue again: see 
https://forum.dlang.org/post/befrzndhowlwnvlqcoxx@forum.dlang.org 
for what I think is happening.

I'm currently experimenting with setting up a fiber, then zeroing 
out its stack completely after the function has run in it. 
Results are mixed, but promising. I still end up with ~100MB live 
at the end though - which admittedly is a lot better than 600MB.


More information about the Digitalmars-d mailing list