Skip to content

Alternative attempt at fixing memleak by being explicit about copies#2722

Draft
filmor wants to merge 5 commits into
masterfrom
alternative-memleak-fix
Draft

Alternative attempt at fixing memleak by being explicit about copies#2722
filmor wants to merge 5 commits into
masterfrom
alternative-memleak-fix

Conversation

@filmor
Copy link
Copy Markdown
Member

@filmor filmor commented May 11, 2026

No description provided.

Finalizer.Instance.ThrottledCollect();
}

public PyObject Copy() => new(this);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The name of this function is too generic and therefore misleading

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

How is it misleading? This is exactly what it does (at least in Python terms). The current behaviour, being able to freely pass the object around, is the misleading thing IMO.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It does not make a copy of an object. It makes a separate living reference to it.

filmor added 4 commits May 12, 2026 10:48
The slot initialisation walks from the most derived type up its
inheritance hierarchy. If a type specifies a `tp_clear` (or any other
slot) and its base type does as well, the (later) base type handling will
overwrite the previously written version.

We now limit ourselves to methods that are declared on the most current
level.
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.

2 participants