How long does the context of a delegate exist?

frame frame86 at live.com
Thu May 27 12:59:02 UTC 2021


I'm using a buffer delegate to fill data from a DLL and use it as 
range like this:

Pseudo-Code:
```d
void DLLFun(out Collector collector) {
   auto something;

   collector = Collector(...);
   collector.registerFillBufferMethod({
      auto data = [];
      //...
      // use of something;
      return data;
   )};
}
```

This collector takes care of the data so the GC cannot collect it 
while not explicitly closed on the caller side.

But what about the data used in the context of the delegate? Does 
this data stay as long DllFun is not called again because the DLL 
stack is paused? Or is this data also volatile and may be 
collected by the GC anytime?


More information about the Digitalmars-d-learn mailing list