Avoid GC with closures
Iakh via Digitalmars-d
digitalmars-d at puremagic.com
Mon May 30 09:06:09 PDT 2016
On Sunday, 29 May 2016 at 11:16:57 UTC, Dicebot wrote:
> On 05/28/2016 09:58 PM, Iakh wrote:
>> Yeah. It doesn't capture any context. But once it does it
>> would be an error.
>
> Custom allocators are not very suitable for things like
> closures because of undefined lifetime. Even if it was allowed
> to replace allocator, you would be limited to either GC or RC
> based one anyway to keep things @safe.
Yes. It's better to pass something like memory management strategy
instead of just allocator like rc ptr or uniquePtr
More information about the Digitalmars-d
mailing list