Re: Debugging a memory leak

2020-10-23 Thread Dieter Maurer
Pasha Stetsenko wrote at 2020-10-23 11:32 -0700: > ... > static int my_init(PyObject*, PyObject*, PyObject*) { return 0; } > static void my_dealloc(PyObject*) {} I think, the `dealloc` function is responsible to actually free the memory area. I see for example: static void Spec_dealloc(Spec* se

Re: Debugging a memory leak

2020-10-23 Thread Pasha Stetsenko
Thanks MRAB, this was it. I guess I was thinking about tp_dealloc as a C++ destructor, where the base class' destructor is called automatically. On Fri, Oct 23, 2020 at 11:59 AM MRAB wrote: > On 2020-10-23 19:32, Pasha Stetsenko wrote: > > Thanks for all the replies! > > Following Chris's advice

Re: Debugging a memory leak

2020-10-23 Thread MRAB
On 2020-10-23 19:32, Pasha Stetsenko wrote: Thanks for all the replies! Following Chris's advice, I tried to reduce the code to the smallest reproducible example (I guess I should have done it sooner), but here's what I came up with: ``` #include #include static int my_init(PyObject*,

Re: Debugging a memory leak

2020-10-23 Thread Pasha Stetsenko
Thanks for all the replies! Following Chris's advice, I tried to reduce the code to the smallest reproducible example (I guess I should have done it sooner), but here's what I came up with: ``` #include #include static int my_init(PyObject*, PyObject*, PyObject*) { return 0; } static voi

Re: Debugging a memory leak

2020-10-23 Thread Dieter Maurer
Pasha Stetsenko wrote at 2020-10-22 17:51 -0700: > ... >I'm a maintainer of a python library "datatable" (can be installed from >PyPi), and i've been recently trying to debug a memory leak that occurs in >my library. >The program that exposes the leak is quite simple: >``` >import datatable as dt >

Re: Debugging a memory leak

2020-10-22 Thread Karen Shaeffer via Python-list
> On Oct 22, 2020, at 5:51 PM, Pasha Stetsenko wrote: > > Dear Python gurus, > > I'm a maintainer of a python library "datatable" (can be installed from > PyPi), and i've been recently trying to debug a memory leak that occurs in > my library. > The program that exposes the leak is quite simp

Re: Debugging a memory leak

2020-10-22 Thread Chris Angelico
On Fri, Oct 23, 2020 at 12:20 PM Pasha Stetsenko wrote: > I'm currently not sure where to go from here. Is there something wrong with > my python object that prevents it from being correctly processed by the > Python runtime? Because this doesn't seem to be the usual case of > incrementing the ref

Debugging a memory leak

2020-10-22 Thread Pasha Stetsenko
Dear Python gurus, I'm a maintainer of a python library "datatable" (can be installed from PyPi), and i've been recently trying to debug a memory leak that occurs in my library. The program that exposes the leak is quite simple: ``` import datatable as dt import gc # just in case def leak(n=10**