Public bug reported:

I have an application (glipper) in which I update the menu quite
frequently, and I noticed a slow rise in memory usage while running, and
I tracked it down to GtkMenuItem.

I noticed this in Ubuntu 10.10, but since there were only a few days to
11.04, I decided to wait. I can also confirm the bug in 11.04.

Please note that this leak happens only if the GtkMenuItem has a label.
There's no leak if it doesn't have a label.

Proof code attached. Glipper is written in Python (with PyGTK), so the
first thing I did to track this down was to create the simplest python
program that demonstrates the bug. Using my friend Google, I managed to
write the same code in Vala and compile it to C (to confirm it doesn't
do anything else but create and destroy GtkMenuItem objects). The leak
still exists after compiling the C source.

How to test:
1. Start "top", sort by memory (<O> <n> <enter>)
2. Run either the python script or the binary resulting from the Vala or C 
sources.
3. Watch the program rise in "top". It will take less than a minute to become 
noticeable.

Reading the source, unless I missed something, I should have at most one
GtkMenuItem at any time, so the memory usage should not increase. So
far, the workaround is to explicitly destroy the GtkMenuItem, but it's
not that convenient.

There may be a similar, but not as evident issue in GtkMenu after
removing a GtkMenuItem, but I haven't pursued that possible problem yet.
I'll file another bug report if I can confirm the GtkMenu leak it's not
just my imagination.

** Affects: gtk+2.0 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is subscribed to gtk+2.0 in Ubuntu.
https://bugs.launchpad.net/bugs/777246

Title:
  Memory leak: Circular reference in GtkMenuItem

-- 
desktop-bugs mailing list
desktop-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs

Reply via email to