On Friday, 10 June 2016 at 00:23:13 UTC, Mathias Lang wrote:
2016-06-10 1:20 GMT+02:00 maik klein via Digitalmars-d <
digitalmars-d@puremagic.com>:
Did you try to send a native delegate ? I would be very
surprised if you were allowed to do so.
That is what I am currently doing and it at least appears to be
working as intended.
Note that not all delegates allocate. Function local delegate
refering to variable do, but the one refering to aggregate
never do.
All my closures/delegated need to capture a local variable. They
capture a pointer to a heap allocated "Cell". I use the cell as a
primitive to write my result into. It has an internal atomic
counter, if the counter as decremented to 0, I know that I can
safely read from it.
I am not sure how I would implement it differently.
So that means that all my delegates allocate, and they allocate
with the GC.