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

[3.11] gh-94207: Fix struct module leak (GH-94239) #94265

Merged
merged 1 commit into from
Jun 25, 2022

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jun 25, 2022

Make _struct.Struct a GC type

This fixes a memory leak in the _struct module, where as soon
as a Struct object is stored in the cache, there's a cycle from
the _struct module to the cache to Struct objects to the Struct
type back to the module. If _struct.Struct is not gc-tracked, that
cycle is never collected.

This PR makes _struct.Struct GC-tracked, and adds a regression test.
(cherry picked from commit 6b86534)

Co-authored-by: Mark Dickinson mdickinson@enthought.com

Make _struct.Struct a GC type

This fixes a memory leak in the _struct module, where as soon
as a Struct object is stored in the cache, there's a cycle from
the _struct module to the cache to Struct objects to the Struct
type back to the module. If _struct.Struct is not gc-tracked, that
cycle is never collected.

This PR makes _struct.Struct GC-tracked, and adds a regression test.
(cherry picked from commit 6b86534)

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
@miss-islington
Copy link
Contributor Author

Status check is done, and it's a success ✅ .

@miss-islington
Copy link
Contributor Author

Status check is done, and it's a success ✅ .

@mdickinson mdickinson merged commit 4bc5f9f into python:3.11 Jun 25, 2022
@miss-islington miss-islington deleted the backport-6b86534-3.11 branch June 25, 2022 14:40
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.

3 participants