Memory leak: Circular reference in GtkMenuItem

Bug #777246 reported by Radu Cristescu
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
GTK+
Expired
Medium
gtk+2.0 (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

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.

Revision history for this message
Radu Cristescu (radu.c) wrote :
Radu Cristescu (radu.c)
description: updated
Changed in gtk:
importance: Unknown → Medium
status: Unknown → New
Changed in gtk+2.0 (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Changed in gtk:
status: New → Incomplete
Changed in gtk:
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.