Skip to content

Fix ref leak in mx.save/load with file like object#3187

Open
aisk wants to merge 1 commit intoml-explore:mainfrom
aisk:save-load-leak
Open

Fix ref leak in mx.save/load with file like object#3187
aisk wants to merge 1 commit intoml-explore:mainfrom
aisk:save-load-leak

Conversation

@aisk
Copy link
Contributor

@aisk aisk commented Mar 1, 2026

Proposed changes

According to Python's documentation: https://docs.python.org/3.14/c-api/memoryview.html#c.PyMemoryView_FromMemory, the PyMemoryView_FromMemory returns new reference need to call Py_DECREF on it.

Checklist

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the necessary documentation (if needed)

Copy link
Member

@angeloskath angeloskath left a comment

Choose a reason for hiding this comment

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

Thanks! That is a great catch!

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