After some investigation it looks like a simple call to apt.Cache() from the python apt module is responsible for the high memory usage of mintUpdate. Without this call mintUpdate uses 4.6MB of RAM. As soon as the module is called the memory usage grows to 47MB. The python interpreter doesn’t free up memory and an additional 47MB of RAM is reserved every time mintUpdate refreshes (every 5 minutes by default).
Of course mintUpdate relies on the apt module to get the list of available packages so we’ll need to find some decent solution to replace this call. Either we’ll manage to force python in freeing the memory used by the module or we’ll rely on APT directly without using the module.
Anyway, the next release of mintUpdate should use around 5MB of RAM and this shouldn’t grow over time.
Note: This comes as excellent news as I was personally worried that we would have to rewrite mintUpdate from scratch using another language. The java-gnome bindings lacked popularity and were not even packaged for Debian. Perl kind of scared me a bit when it came to OO-threaded development and I wasn’t particularly amused at the thought of using C++ (although I must say I was quite impressed with how Eclipse handles C++ and with the quality of the Gtkmm API). Well anyway, more on this later.. and hopefully we’ll stay with Python, at least for already existing Mint apps.
Edit: Apparently python won’t let us force any garbage collection. However the apt module can be replaced entirely by calls to “sudo apt-get -s upgrade | grep ^Inst” and “sudo apt-get -s dist-upgrade | grep ^Inst”. We’ll even save calculating dependencies ourselves…