Skip to content

Conversation

@robsdedude
Copy link
Member

@robsdedude robsdedude commented Jul 24, 2025

The extensions implementation of packstream Structure could leak memory when being part of a reference cycle. In reality this doesn't matter because the driver never constructs cyclic Structures. Every packstream value is a tree in terms of references (both directions: packing and unpacking).

This change is meant to harden the extensions against introducing effective memory leaks in the driver should the driver's usage of Structure change in the future.

See also https://pyo3.rs/v0.22.0/class/protocols#garbage-collector-integration

The extensions implementation of packstream `Structure` could leak memory when
being part of a reference cycle. In reality this doesn't matter because the
driver never constructs cyclic `Structure`s. Every packstream value is a tree in
terms of references (both directions: packing and unpacking).

This change is meant to harden the extensions against introducing effective
memory leaks in the driver should the driver's usage of `Structure` change in
the future.
@robsdedude robsdedude changed the title Harden against memory leak Harden Structure against memory leak Jul 24, 2025
@robsdedude robsdedude marked this pull request as ready for review July 24, 2025 13:48
Copy link

@StephenCathcart StephenCathcart left a comment

Choose a reason for hiding this comment

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

👍

@robsdedude robsdedude enabled auto-merge (squash) July 29, 2025 12:35
@robsdedude robsdedude disabled auto-merge July 29, 2025 13:56
@robsdedude robsdedude merged commit 1a26797 into 6.x Jul 29, 2025
8 checks passed
@robsdedude robsdedude deleted the harden-against-memory-leak branch July 29, 2025 13:56
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