I created an issue and added a PR that I believe covers all of the unmanaged memory. The only thing I know is still unmanaged is the PyGetSetDef closure, but I am not sure what to do about that. Also, users can opt-out of that API so it's less of an issue.
https://bugs.python.org/issue37270
On Wed, Jun 12, 2019 at 2:54 PM Andrew Svetlov <andrew.svetlov@gmail.com> wrote:
Agree with Jeroen and Steve
On Wed, Jun 12, 2019 at 6:59 PM Steve Dower <steve.dower@python.org> wrote:
On 11Jun2019 1842, Joe Jevnik via capi-sig wrote:
One idea I have is to change PyCFunctionObject to hold a PyMethodDef *value* instead of a pointer. I don't think the extra foot print size
affect much, and will lower the total memory usage of a PyCFunctionObject by one pointer. If anything, it avoids a second indirection to find the function's implementation. I wanted to poll this list before working on this to see if this has already been discussed or if I am just doing something wrong. PyCFunctionObject is not part of the limited ABI, so
will this
should be a stable ABI compatible change. We can make this same change in PyType_Ready for statically allocated types.
As Jeroen suggested, I think it's not just okay but a *good* thing for PyCFunctionObject to not have to refer back to the PyMethodDef. I've certainly run into this problem before.
We can still use PyMethodDef as the input value, but unless we have a particular public API for retrieving it (which I don't recall we do), it may as well just go away at that point.
My guess is it made perfect sense when everything was static, but no longer does now.
Cheers, Steve
capi-sig mailing list -- capi-sig@python.org To unsubscribe send an email to capi-sig-leave@python.org
-- Thanks, Andrew Svetlov