DRAFT relating to three seventy#1
Draft
b-long wants to merge 10 commits into
Draft
Conversation
malloc(strlen(str)) left no room for the null terminator; sprintf wrote one byte past the end, corrupting the next heap chunk. Previously masked by GOGC=off; now detected by glibc malloc with normal GC enabled.
Python's gc.collect() releases Python wrappers and calls DecRef(), removing
Go objects from the handle map. However, Go's own GC does not run at that
point, so Go-heap memory (structs, slices) stays resident until Go's
allocator threshold is reached. On macOS, ru_maxrss is in bytes instead of
KB, making the leak threshold meaningful (~82 MB), so the second test pass
can see RSS growth before Go GC has had a chance to reclaim the first
pass's allocations -- causing a false-positive leak report.
Fix in bind/gen.go:
- Add RunGC() (calls runtime.GC()) to the generated Go extension.
- Register a Python gc.callbacks handler in the generated Python wrapper
that calls _{pkg}.RunGC() whenever Python GC stops. This is transparent
to users: Go GC fires automatically after every Python GC cycle, keeping
the two runtimes in sync without any user-visible API change.
Remove the darwin skip from main_test.go: now that Go GC is synchronised
with Python GC, TestCStrings is reliable on all platforms including both
macOS/Intel and macOS/ARM.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.