-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
_Py_DECREF_SPECIALIZED doesn't respect pymalloc tracking #125703
Comments
CC: @sweeneyde @Yhg1s |
CC: @mdboom @markshannon |
I suspect that we are missing more calls to tracemalloc hooks when the memory is reused. Basically every call to |
…CREF paths (pythonGH-125704) (cherry picked from commit f8ba9fb) Co-authored-by: Pablo Galindo Salgado <[email protected]>
…CREF paths (pythonGH-125704) (cherry picked from commit f8ba9fb) Co-authored-by: Pablo Galindo Salgado <[email protected]>
…CREF paths (pythonGH-125704) (cherry picked from commit f8ba9fb) Co-authored-by: Pablo Galindo Salgado <[email protected]>
3.11 and 3.12 are not affected because there is no |
The macro version in ceval.c may also be affected: Line 93 in f8ba9fb
I might be misunderstanding how the macros expand, but I believe this macro is unused anyway. |
…specialized paths
@pablogsal You seem to be claiming that #30872 caused a regression in a feature added in #115945. Combined with such comments as this, it feels like you are trying to shift the blame for this issue. |
I am not shifting blame for anything. Among other things because there is no need to blame anyone. And by fixing a bug I am not blaming anyone. I am trying to fix a bug in a feature we released in 3.13. What I am complaining in that comment is that I am trying to fix a bug in 3.13 (in a new feature or in a old feature, whatever you prefer) and you are complaining about a PR that already landed, with a feature that was already decided with comments such as #125704 (comment) where you say things like "Can we please stop doing this" in a PR that's trying to fix a bug. #30872 affects for tracemalloc AND therefore also affect the hooks I added #115945. The regression of the feature is for tracemalloc which was added many releases ago. Tracemalloc tracks object creation and destruction to be able to call Tracemalloc in 3.13 has been unified to use the hooks we added in #115945 but the regression would still be there if the hooks were not added. Even if you don't want to call this a "regression", it's a bug in a feature we added to 3.13 and start complaining about the feature in the bug fix PR is not productive and that's what I am trying to say in #125704 (comment) |
…specialized paths
I think that we should first make the code correct (fix tracemalloc/the callback), then make the code fast. |
@vstinner I don't see any value in making trite comments like "first make the code correct, then make the code fast"? It suggests that correctness and performance are totally unrelated. Often considering performance will lead to a more streamlined implementation that can be more maintainable. For example, if tracemalloc was entirely built on PEP 445 (as PEP 454 states it would), there would be no issue in the first place as all allocations and frees would be done through the PEP 445 function pointer(s). |
Ok, so @markshannon and I had a catch up call about this. We discussed our views and we clarified our positions a bit better. Here is what we have agreed:
|
Opened #125790 |
I'm closing this as the issue is fixed and the performance discussion can be moved to the new issue. Thanks a lot everyone for your comments and help. |
…DECREF specialized paths (pythonGH-125712) (cherry picked from commit 3d1df3d) Co-authored-by: Pablo Galindo Salgado <[email protected]>
PR #30872 added
_Py_DECREF_SPECIALIZED
which callsdestruct
over the object. Whendestruct
isPyObject_Free
this skipstracemalloc
counting reporting that the memory is alive. This also makes debuggers segfault because they think that the object is alive because they did not get a notification. This is the code that's not getting called:cpython/Objects/object.c
Lines 2924 to 2928 in 2e950e3
This may also qualify a regression as makes tracemalloc detect incorrect memory usage for these objects
Linked PRs
The text was updated successfully, but these errors were encountered: