Skip to content

Fix memory leak in str() of fmpz_mpoly, fmpq_mpoly, fmpz_mod_mpoly, nmod_mpoly - #436

Merged
oscarbenjamin merged 3 commits into
flintlib:mainfrom
UriKH:fix/mpoly-str-leak
Oct 22, 2026
Merged

oscarbenjamin merged 3 commits into
flintlib:mainfrom
UriKH:fix/mpoly-str-leak

Conversation

@UriKH

@UriKH UriKH commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #435

Comment thread src/flint/test/test_all.py Outdated
Comment on lines +3969 to +3976
def _peak_rss_mb() -> float:
"""Peak resident set size of this process in MB (``resource`` is Unix only)."""
import resource
peak = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
return peak / (2**20 if platform.system() == "Darwin" else 1024)


def test_mpoly_str_does_not_leak():

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We don't need this kind of test for a memory leak once it is fixed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed the test in a new commit

Removing unnecessary test
@oscarbenjamin

Copy link
Copy Markdown
Collaborator

Looks good. Thanks!

@oscarbenjamin
oscarbenjamin merged commit edf7e54 into flintlib:main Oct 22, 2026
103 checks passed
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.

str() leaks at fmpz_mpoly, fmpq_mpoly, fmpz_mod_mpoly, nmod_mpoly

2 participants