This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Python] Patch to fix memory leak


Paul Koning <paulkoning@comcast.net> writes:

> PyList_Append increments the reference count of the item being
> appended to the list, and two of the places in the GDB Python code
> that use it don't take that into account.  The result is a memory
> leak.  The attached patch fixes that.

For some reason the Python API manual is silent about PyList_Append
incrementing the reference count.  But I did check, and you are correct,
the reference count is incremented when added to a list.  

> Tested by using a debug build of Python with reference counting
> enabled, and turning on dumping of final leftover objects.

This is fine, thanks for doing this.  I cannot give you check-in
permission as I am not a maintainer.  Please wait until one of the
maintainers signs-off before you go ahead.

Cheers,

Phil


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]