Repository navigation
fix: avoid retaining Database.info results - #273
Draft
sricharanreddycheruku wants to merge 1 commit into
Draft
sricharanreddycheruku wants to merge 1 commit into
sricharanreddycheruku wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Database.info()leaks its returned bytes object on every successful call.PyBytes_FromString()already returns a new reference, but the extraPy_INCREF()leaves one reference behind after the caller discards the result.Repeated database inspection therefore accumulates memory indefinitely.
Return the existing new reference after freeing the native info string. This
also allows a failed bytes allocation to propagate its NULL result rather than
incrementing a NULL pointer; allocation failure was not injected locally.
Add four bounded allocation regressions beside the existing info test, covering
block, stream, vectored and Chimera databases. Each discards 1,000 info results
and checks allocations traced to the test file. The test preserves an existing
tracemalloc session and allows 4 KiB for bookkeeping. On the original extension,
those calls retain 71–79 KiB on Python 3.12 and 87–95 KiB on free-threaded 3.14.
A separate snapshot reproducer confirms 1,000 retained bytes objects per mode
before the fix and none afterward.
Validation on Linux with source-built wheels and
PYTHONMALLOC=debug:free-threaded 3.14.7.
extension keeps the GIL disabled.
lifetime failure addressed separately by Release compile metadata references and propagate ID lookup errors #265. This branch does not include
that fix.
and
git diff --checkpass. Existing unrelated formatting/lint issues intests/test_hyperscan.pyare unchanged.Independent branch from current main; no linked issue or API change.