
On Tue, May 25, 2010 at 04:10:27AM +1200, Nigel Jones wrote:
Hi List,
Please find below a patch that should correct two memory leaks within the udev device handling code.
The issue is triggered by 'add' udev calls and will slowly cause libvirtd to consume the majority of system memory.
The first part of the patch deals with udevAddOneDevice() and frees the memory allocated to 'def' if the function would return -1 (an error condition) due to the inability to look up udev properties (for example, if the udev device is already removed).
The second part of the patch deals with a remaining 8kB/cycle memory leak, in which the udev device reference isn't released at the end of running udevEventHandleCallback().
I'm happy to answer any questions about the patch, there is also a bit more background at https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/571093
Hi Nigel, Thanks for reporting this, and the patch. While reviewing your patch, I found an additional leak in the remove case which I have also addressed in the attached patch, which is otherwise just a slight modification of yours. I was able to reproduce the leaks by running a device add/remove cycle, and I do not see memory leakage after applying this patch. Let me know if it fixes it for you as well. Dave