-
-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix sqrt(sqrt(2)) memory leak in ginac numeric.cpp #36046
Fix sqrt(sqrt(2)) memory leak in ginac numeric.cpp #36046
Conversation
pep8 and import cleanup
pep8 cleanup
5723eea
to
2286629
Compare
Note to self: the numeric::numeric ctor transfers ownership of the mpz_t, so no clear in that one code path. Tests pass now! Setting this to needs review for now, a better valgrind integration needs the pypi/valgrind PR that will be tracked there. |
Documentation preview for this PR (built with commit 2286629; changes) is ready! 🎉 |
Use the new .supp file in |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Works for me, thanks! |
Fix the memory leak when computing the outer sqrt in `sqrt(sqrt(2))`, as reported on sage devel at https://groups.google.com/g/sage- devel/c/6zpxQKXtJgk The unit test is a WIP and depends on tekknolagi/valgrind#1 - Resolves sagemath#33074 URL: sagemath#36046 Reported by: Volker Braun Reviewer(s): Matthias Köppe
<!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> As noted in sagemath#36046 (comment), `sage -t --valgrind` does not work because it instruments the wrong process. As part of the fix, we move the contents of `src/bin/sage-runtests` to `src/bin/sage/doctest/__main__.py` so that the doctester can be invoked as `sage -python -m sage.doctest`. We also arrange for `sage -t --valgrind` to use the suppressions file added in sagemath#36046. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#37569 Reported by: Matthias Köppe Reviewer(s): Kwankyu Lee
<!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> As noted in sagemath#36046 (comment), `sage -t --valgrind` does not work because it instruments the wrong process. As part of the fix, we move the contents of `src/bin/sage-runtests` to `src/bin/sage/doctest/__main__.py` so that the doctester can be invoked as `sage -python -m sage.doctest`. We also arrange for `sage -t --valgrind` to use the suppressions file added in sagemath#36046. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#37569 Reported by: Matthias Köppe Reviewer(s): Kwankyu Lee
<!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> As noted in sagemath#36046 (comment), `sage -t --valgrind` does not work because it instruments the wrong process. As part of the fix, we move the contents of `src/bin/sage-runtests` to `src/bin/sage/doctest/__main__.py` so that the doctester can be invoked as `sage -python -m sage.doctest`. We also arrange for `sage -t --valgrind` to use the suppressions file added in sagemath#36046. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#37569 Reported by: Matthias Köppe Reviewer(s): Kwankyu Lee
<!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> As noted in sagemath#36046 (comment), `sage -t --valgrind` does not work because it instruments the wrong process. As part of the fix, we move the contents of `src/bin/sage-runtests` to `src/bin/sage/doctest/__main__.py` so that the doctester can be invoked as `sage -python -m sage.doctest`. We also arrange for `sage -t --valgrind` to use the suppressions file added in sagemath#36046. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#37569 Reported by: Matthias Köppe Reviewer(s): Kwankyu Lee
<!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> As noted in sagemath#36046 (comment), `sage -t --valgrind` does not work because it instruments the wrong process. As part of the fix, we move the contents of `src/bin/sage-runtests` to `src/bin/sage/doctest/__main__.py` so that the doctester can be invoked as `sage -python -m sage.doctest`. We also arrange for `sage -t --valgrind` to use the suppressions file added in sagemath#36046. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#37569 Reported by: Matthias Köppe Reviewer(s): Kwankyu Lee
<!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> As noted in sagemath#36046 (comment), `sage -t --valgrind` does not work because it instruments the wrong process. As part of the fix, we move the contents of `src/bin/sage-runtests` to `src/bin/sage/doctest/__main__.py` so that the doctester can be invoked as `sage -python -m sage.doctest`. We also arrange for `sage -t --valgrind` to use the suppressions file added in sagemath#36046. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#37569 Reported by: Matthias Köppe Reviewer(s): Kwankyu Lee
<!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> As noted in sagemath#36046 (comment), `sage -t --valgrind` does not work because it instruments the wrong process. As part of the fix, we move the contents of `src/bin/sage-runtests` to `src/bin/sage/doctest/__main__.py` so that the doctester can be invoked as `sage -python -m sage.doctest`. We also arrange for `sage -t --valgrind` to use the suppressions file added in sagemath#36046. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#37569 Reported by: Matthias Köppe Reviewer(s): Kwankyu Lee
<!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> As noted in sagemath#36046 (comment), `sage -t --valgrind` does not work because it instruments the wrong process. As part of the fix, we move the contents of `src/bin/sage-runtests` to `src/bin/sage/doctest/__main__.py` so that the doctester can be invoked as `sage -python -m sage.doctest`. We also arrange for `sage -t --valgrind` to use the suppressions file added in sagemath#36046. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#37569 Reported by: Matthias Köppe Reviewer(s): Kwankyu Lee
Fix the memory leak when computing the outer sqrt in
sqrt(sqrt(2))
, as reported on sage devel at https://groups.google.com/g/sage-devel/c/6zpxQKXtJgkThe unit test is a WIP and depends on tekknolagi/valgrind#1