Skip to content

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

Merged
angeloskath merged 1 commit into
ml-explore:mainfrom
aisk:save-load-leak
Mar 3, 2026
Merged

Fix ref leak in mx.save/load with file like object#3187
angeloskath merged 1 commit into
ml-explore:mainfrom
aisk:save-load-leak

Conversation

@aisk

@aisk aisk commented Mar 1, 2026

Copy link
Copy Markdown
Contributor

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)

@angeloskath angeloskath left a comment

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.

Thanks! That is a great catch!

@angeloskath angeloskath merged commit 1ce7118 into ml-explore:main Mar 3, 2026
16 checks passed
@aisk aisk deleted the save-load-leak branch March 3, 2026 02:06
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