I'm using a buffer delegate to fill data from a DLL and use it as range like this:
Pseudo-Code:
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?