GC for pure functions -- implementation ideas

Jason House jason.james.house at gmail.com
Sun Apr 17 11:44:18 PDT 2011


Don Wrote:
> Tomek Sowiñski wrote:
> > I'm far from being a GC expert but I think Java having identified such cases with escape analysis just puts locally allocated objects on the stack.
> 
> That works for the non-leaky function itself, but it doesn't help for 
> the functions it calls.

It'd reduce the use of the pure heap to leaky pure functions called from pure functions. If I understood the original proposal correctly, this would reduce how frequently pure functions have to manipulate the pure stack. I haven't thought through the exception handling case, so I may be completely wrong!

I was originally assuming the return type of a pure function was enough to determine if it wasn't leaky, but now I'm thinking only pure nothrow functions can be non-leaky. That might make the stack allocation optimization too rare to be worthwhile?


More information about the Digitalmars-d mailing list