mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
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>
The file test.py here is from the Zope project, and is Copyright (c) 2001, 2002 Zope Corporation and Contributors. This file is released under the Zope Public License, version 2.0, a copy of which is in the file ZPL-2.0.