[dmd-internals] Memory Leak

Don Clugston dclugston at gmail.com
Wed Nov 14 04:30:02 PST 2012


On 14 November 2012 10:14, Walter Bright <walter at digitalmars.com> wrote:
>
> On 11/14/2012 1:03 AM, Don Clugston wrote:
>>
>>
>> At least, the ones created by const-folding are short-lived, and there
>> is rather a lot of them. This is extreme for CTFE, which is why CTFE
>> leaks so much memory.
>> Though actually I want to stop CTFE from creating mountains of garbage
>> in the first place.
>> I don't know how much of the total garbage is from const folding though.
>>
>
> What do you think of the feasibility of just having CTFE use reference
> counting?

I've been working towards CTFE owning all of its expressions.
An interesting thing about CTFE is that it's all strongly pure, so a
pool-based approach works really well. When CTFE finishes, copy the
result into new Expressions not owned by CTFE.
Then drop everything in the CTFE memory pool.


More information about the dmd-internals mailing list