You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As per the MSDN documentation, any delegate that's passed to unmanaged code as a function pointer needs to be explicitly kept alive in managed code, since the GC doesn't track pointers on the unmanaged side.
We have many such delegates in LLVMSharp. In LLVMSharp.Api, I intend to have the relevant wrapper classes manage their lifetimes so the user won't have to call GC.KeepAlive() on them. For example, a delegate that logically belongs to a Context will be kept alive privately and will be released only when the Context is Disposed.
The text was updated successfully, but these errors were encountered:
Sounds good. Great work on the OOApi, I'm still focusing on getting this runnable on as many platforms, so it's good we're doing non overlapping stuff.
As per the MSDN documentation, any delegate that's passed to unmanaged code as a function pointer needs to be explicitly kept alive in managed code, since the GC doesn't track pointers on the unmanaged side.
We have many such delegates in LLVMSharp. In
LLVMSharp.Api
, I intend to have the relevant wrapper classes manage their lifetimes so the user won't have to callGC.KeepAlive()
on them. For example, a delegate that logically belongs to aContext
will be kept alive privately and will be released only when theContext
isDisposed
.The text was updated successfully, but these errors were encountered: