[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 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. But it seems like Oracle is still actively using it? Would you be happy to step up to be the maintainer of this binding? I wouldn't expect too much traffic regarding this piece of code (there were only 8 commits so far in this cycle touching this binding, most of which cosmetic), so the workload wouldn't be a big problem. With a maintainer and active user in place we can probably avoid some of the back and forth when touching this piece of code. For example: commit ec55a3ae01a5be34d9a753781fba41d5930569f0 Author: Wei Liu <wei.liu2@xxxxxxxxxx> Date: Mon Jul 27 18:45:08 2015 +0100 python/xc: reinstate original implementation of next_bdf I missed the fact that next_bdf is used to parsed user supplied strings when reviewing. The user supplied string is a NULL-terminated string separated by comma. User can supply several PCI devices in that string. There is, however, no delimiter for different devices, hence we can't change the syntax of that string. This patch reinstate the original implementation of next_bdf to preserve the original syntax. The last argument for xc_assign_device is always 0. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> commit 9b34056cb4cab826771dba031735f77a02df015c Author: Tiejun Chen <tiejun.chen@xxxxxxxxx> Date: Wed Jul 22 01:40:08 2015 +0000 tools: extend xc_assign_device() to support rdm reservation policy This patch passes rdm reservation policy to xc_assign_device() so the policy is checked when assigning devices to a VM. Note this also bring some fallout to python usage of xc_assign_device(). CC: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> CC: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> CC: Ian Campbell <ian.campbell@xxxxxxxxxx> CC: Wei Liu <wei.liu2@xxxxxxxxxx> CC: David Scott <dave.scott@xxxxxxxxxxxxx> Signed-off-by: Tiejun Chen <tiejun.chen@xxxxxxxxx> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> You will also get least surprise when using the binding in new version of Xen. Wei. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |