[dmd-internals] Memory Leak

David Held dmd at wyntrmute.com
Wed Nov 14 10:10:05 PST 2012


On 11/14/2012 4:30 AM, Don Clugston wrote:
>
> [...]
> 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.

I.e.: A custom region allocator.  That's pretty much the fastest kind 
you can get, but it does require you to manage lifetimes correctly.  I 
suspect that larger portions of dmd could also benefit from a region 
allocator, but it may be harder to draw the line around the lifetime 
scope like you can with CTFE.  Probably dmd needs to be profiled to see 
the big-picture pattern of allocations.

Dave



More information about the dmd-internals mailing list