From: Ian Campbell <ian.campbell@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>, Andrew Cooper <andrew.cooper3@citrix.com>
Cc: xen-devel@lists.xenproject.org, Zhigang Wang <zhigang.x.wang@oracle.com>
Subject: Re: [PATCH] python/xc: add missing Py_DECREF() to fix a memory leak
Date: Tue, 1 Sep 2015 12:07:28 +0100 [thread overview]
Message-ID: <1441105648.27618.40.camel@citrix.com> (raw)
In-Reply-To: <20150831123208.GA7274@zion.uk.xensource.com>
On Mon, 2015-08-31 at 13:32 +0100, Wei Liu wrote:
> 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@oracle.com>
> > > Acked-by: Wei Liu <wei.liu2@citrix.com>
> > >
> > > 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.
I too would be happy to see a patch to MAINTAINERS adding a section
covering at least tools/python/xen/lowlevel/xc (maybe xs too) and some
names of some actual users/maintainers of that code.
I think the xl bindings are properly dead and should be removed.
Ian.
next prev parent reply other threads:[~2015-09-01 11:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-28 21:35 [PATCH] python/xc: add missing Py_DECREF() to fix a memory leak Zhigang Wang
2015-08-31 12:04 ` Wei Liu
2015-08-31 12:27 ` Andrew Cooper
2015-08-31 12:32 ` Wei Liu
2015-09-01 11:07 ` Ian Campbell [this message]
2015-09-01 11:37 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1441105648.27618.40.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
--cc=zhigang.x.wang@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.