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(*) catch and fix more GC corner cases #178

Merged
merged 8 commits into from
Jul 23, 2024
Merged

fix(*) catch and fix more GC corner cases #178

merged 8 commits into from
Jul 23, 2024

Conversation

fffonion
Copy link
Owner

No description provided.

@fffonion fffonion force-pushed the valgrind-gc branch 5 times, most recently from 4c7cc18 to 8abdb67 Compare July 22, 2024 20:59
@fffonion fffonion changed the title tests(ci) catch more GC corner cases fix(*) catch and fix more GC corner cases Jul 22, 2024
ffi_gc(got_ref, stack_lib.gc_of("GENERAL_NAME"))
got = ffi_cast("GENERAL_NAMES*", got_ref)''',
got = ffi_cast("GENERAL_NAMES*", got_ref)
ffi_gc(got, stack_lib.gc_of("GENERAL_NAME"))''',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have set ffi.gc function for got_ref in the upper layer function, then the underlying object would be freeed two times by the ffi.gc.

Copy link
Owner Author

@fffonion fffonion Jul 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't be double free because got_ref is a opaque pointer, it doesn't have GC handler to free the pointed object. we only have gc handler for got.

@fffonion
Copy link
Owner Author

@zhuizhuhaomeng The tests are now green with the new valgrind setup, I'm going to merge this and looking to make the tests faster. Any suggestions are welcomed! And thanks for bringing this up, it's also a learning
opportunity for me : )

@fffonion fffonion merged commit 1f7d7b3 into master Jul 23, 2024
8 checks passed
@fffonion fffonion deleted the valgrind-gc branch July 23, 2024 02:58
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