-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GC strategies should be double-checked. #19
Comments
How do functions like |
further complicating things is that when you get a reference to an underlying C structure from openssl, sometimes it is a new object you have to free, and sometimes it is an object who has a lifetime bound to the parent object and no free of the child object is necessary or needed |
Yeah, that's why I have |
oh, okay got it |
…_quick_fix Commenting out not used consts, for OpenSSL v1.1.0 compatibility.
Any time a C struct is allocated under a Go struct, a GC finalizer should be added to the Go struct with
runtime.SetFinalizer
, unless "ownership" of the object passes to OpenSSL (which is hard to verify).For this to work, Go objects need to maintain references to potentially GC-able objects, otherwise OpenSSL allocations still in use when GC runs will cause segfaults as in #10.
This can be made simpler for some objects with a 1:1 mapping by embedding C structs in Go objects and using OpenSSL's
_init()
instead of_new()
functions, like done by the SHA implementation.Examples:
EVP_PKEY_free
is called, but maybe needs to be tracked on Ctx when you call aUsePrivateKey()
function or set a key on a cert (in theory)The text was updated successfully, but these errors were encountered: