Skip to content
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

fix: keep alive structs for C usage #140

Merged
merged 1 commit into from
Dec 12, 2023
Merged

Conversation

secDre4mer
Copy link
Contributor

When accessing C fields or functions, there was a potential race condition with the garbage collector running the finalizer if the object was no longer referenced elsewhere. This race was (mostly) short, but arguably still existed.
Use KeepAlive() to safeguard these accesses and ensure the object is only garbage collected (and the C part freed) once the access has finished.

When accessing C fields or functions, there was a potential race
condition with the garbage collector running the finalizer if
the object was no longer referenced elsewhere. This race was
(mostly) short, but arguably still existed.
Use KeepAlive() to safeguard these accesses and ensure the object
is only garbage collected (and the C part freed) once the access
has finished.
@secDre4mer secDre4mer changed the title feat: keep alive structs for C usage fix: keep alive structs for C usage Dec 8, 2023
@hillu hillu merged commit 1bab2fc into hillu:master Dec 12, 2023
1 check passed
@secDre4mer secDre4mer deleted the keepalive branch December 12, 2023 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants