[Kimchi-devel] [RFC] Adding pynotify as dependency to solve YUM API leak

Daniel Henrique Barboza dhbarboza82 at gmail.com
Wed May 27 13:33:19 UTC 2015


Hello everyone,

I've been working in a memory leak in the Host tab, in which every 
reload of the tab
adds up 4Mb in the heap mem size of Kimchi. This may seem small but it 
really adds up
when running kimchi from a long time and with multiple users.

The leak is being generated in the YUM API, where each new instance is 
leaving objects
in the heap. AFAIK it doesn't matter if you force the python GC to clear 
the object (calling
del <obj>) because the API reportedly does not clean itself properly due 
to circular references
within its code. yum-updated itself runs the API in a separated, 
short-lived helper to contain
the leak problems of the API.

The API is used to get the repository list and the packages to be 
updated (RPM/YUM distros only).
The latter can be done by parsing yum check-update with minimal debug 
level. The former is
a little trickier but can be done by reading the .repo files in 
/etc/yum.repos.d.

To make the code smarter (ATM it refreshes all the repos from the rpmdb 
every run of
getList() ) I would like to use pyinotify. This is a python API for 
inotify, a kernel module
that sends file system notifications to user space. That way I can 
refresh the repo
list only if there is any chance in the repository dir.


Thoughts?



More information about the Kimchi-devel mailing list