
But again this is for PyObjects only.
Not really, we check also memory blocks: https://github.com/python/cpython/blob/master/Lib/test/libregrtest/refleak.p... as long as you don't directly call malloc and use one of the Python specific APIs like PyMem_Malloc then the reflect code should catch that. On Wed, 13 May 2020 at 12:29, Giampaolo Rodola' <g.rodola@gmail.com> wrote:
On Wed, May 13, 2020 at 9:17 AM Ammar Askar <ammar@ammaraskar.com> wrote:
Py_DECREF calls in the C code
I think this part specifically is already covered through refleak checks: https://github.com/python/cpython/blob/master/Lib/test/libregrtest/refleak.p...
Since it can involve the repetition of tests many times, these aren't run on the CI though, they do get run on the refleak buildbots so issues get caught eventually: https://buildbot.python.org/all/#/builders?tags=%2Brefleak
But again this is for PyObjects only. Were you able to find any memory leaks with your proof-of-concept? I don't think there's a lot of chances of someone missing a PyMem_Free call and there's not a lot of other manual memory management but I could be wrong. Anything found there could help motivate adding this a bit more.
Yeah, I agree it depends on how many PyMem_* occurrences are there, and it probably makes more sense to cover those ones only. Under Modules/* I found:
- 24 occurrences for PyMem_RawMalloc - 2 for PyMem_RawCalloc - 106 for PyMem_Malloc - 12 for PyMem_Calloc - 39 for PyMem_New - 5 for " = malloc("
I spent an hour covering around 20 of those and didn't find any leak. It's a boring work. I will try to work on it over the next few weeks.
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/C7ZZRDPG... Code of Conduct: http://python.org/psf/codeofconduct/