On Thursday, 28 January 2021 at 22:11:40 UTC, tsbockman wrote:

Alternatively, you can design your APIs so that no pointer to GC memory is ever owned or mutated by any thread unknown to that GC. (This is the only option when working across language boundaries.)

Yes, thank you for your input - I was already thinking about that as it shows the better design and also wouldn't require that the DLL itself build-in much redundant code.

However, if I run GC.collect() after every DLL function was done then it clearly shows which data goes away and bite me. Basically most objects are allocated in the main EXE/DLL anyway - it only comes in trouble where a new separate object is returned by the sub DLL - GC.addRoot() really solves that problem.

Reply via email to