[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] python/xc: add missing Py_DECREF() to fix a memory leak



On Mon, Aug 31, 2015 at 01:27:35PM +0100, Andrew Cooper wrote:
> On 31/08/2015 13:04, Wei Liu wrote:
> > On Fri, Aug 28, 2015 at 05:35:18PM -0400, Zhigang Wang wrote:
> >> Python PyList_Append() will increase reference count of the item. We have 
> >> to
> >> decrease its reference count to let it garbage collected.
> >>
> >> We missed the Py_DECREF() for 'cpuinfo_obj' here, thus we have a memory 
> >> leak.
> >>
> >> The memory leak could be easily confirmed by:
> >>
> >>   # python
> >>   >>> import xen.lowlevel.xc
> >>   >>> xc = xen.lowlevel.xc.xc()
> >>   >>> for i in range(1000): xc.getcpuinfo(1)
> >>
> >> And check the python process memory usage before and after:
> >>
> >>   # ps f -o vsize,rss,%mem,size,cmd -p <pid>
> >>
> >> Signed-off-by: Zhigang Wang <zhigang.x.wang@xxxxxxxxxx>
> > Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
> >
> > There is no in-tree user of python binding, I was planning to remove it
> > in 4.7 window.
> 
> I am sure I have mentioned this in the past, but XenServer still uses
> them in places, and they are very useful to use from interactive sessions.
> 

That's why I said "was". :-)

I don't mind leaving it in-tree given there is out-of-tree users.  The
problem is I don't think I can do a good job maintaining this piece of
code that I don't use and can't test, hence I encourage users to step
forward to maintain this piece of code.

Wei.

> ~Andrew
> 
> (Oracle are still using them as they are still using xend)


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.