Skip to content

Conversation

@miss-islington
Copy link
Contributor

@miss-islingtonmiss-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
ContributorAuthor

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

@miss-islington
Copy link
ContributorAuthor

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

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

@miss-islington@mdickinson@bedevere-bot