I have made some progress. It looks like the problem is a combination of an upstream bug, and the addition of application indicators to the Ubuntu version of GPM (gnome-power-manager).
First of all this bug is in gnome-power-manager, and should be moved back to that package.
Upstream: I built and installed a fresh upstream copy of GPM (2.30.0), and could reproduce the issue by repeatedly right/left clicking on the battery icon. Every time I click on the ICON and extra 4kB of memory is used. It looks like the leak has been upstream for quite a while, but nobody probably noticed it because you would need to click the battery icon thousands of times for it to be a problem.
Ubuntu: Ubuntu version of GPM suffers badly from this leak, because it installs a callback that regenerates the battery status every time there is a change in the battery state. Effectively meaning the left/right click happens automatically on Ubuntu systems. On my hardware this means every second the menu is regenerated with a new battery % value, leaking the old menu.
So I think this could be fixed upstream. Alternatively I think I know enough now to generate a patch which would fix this on Ubuntu (albeit in a slightly hacky way).
I have made some progress. It looks like the problem is a combination of an upstream bug, and the addition of application indicators to the Ubuntu version of GPM (gnome- power-manager) .
First of all this bug is in gnome-power- manager, and should be moved back to that package.
Upstream: I built and installed a fresh upstream copy of GPM (2.30.0), and could reproduce the issue by repeatedly right/left clicking on the battery icon. Every time I click on the ICON and extra 4kB of memory is used. It looks like the leak has been upstream for quite a while, but nobody probably noticed it because you would need to click the battery icon thousands of times for it to be a problem.
Ubuntu: Ubuntu version of GPM suffers badly from this leak, because it installs a callback that regenerates the battery status every time there is a change in the battery state. Effectively meaning the left/right click happens automatically on Ubuntu systems. On my hardware this means every second the menu is regenerated with a new battery % value, leaking the old menu.
So I think this could be fixed upstream. Alternatively I think I know enough now to generate a patch which would fix this on Ubuntu (albeit in a slightly hacky way).