After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 79720 - Memory leak in Win32 GTK+ version
Memory leak in Win32 GTK+ version
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Win32
2.0.x
Other Windows
: Normal normal
: ---
Assigned To: Tor Lillqvist
Tor Lillqvist
Depends on:
Blocks:
 
 
Reported: 2002-04-24 08:21 UTC by Tor Lillqvist
Modified: 2011-02-04 16:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test program (1.09 KB, text/plain)
2002-04-24 08:22 UTC, Tor Lillqvist
Details
small example that leaks memory in gtk_widget_queue_draw (686 bytes, text/plain)
2002-08-08 14:59 UTC, Reade Rintoul
Details

Description Tor Lillqvist 2002-04-24 08:21:13 UTC
Richard Warren's mail to the gimpwin-dev list:

The simple test-program below creates a label and changes the text in it
repeatedly.  It seems to eat memory at a rate of about 8kbytes/sec until it
dies.

I'm using the Win32 2002-03-14 version of GTK+ V2 from Tor's website.  The
problem doesn't happen on Linux with V2.0.0 (but used to happen with
V1.3.9).

Interestingly, when the program is minimised and then opened up again it
seems to free a lot of the memory, but I can't force my users to do that
periodically unfortunately.

Does anybody have any suggestions of how I can fix/avoid this please?  I'm
starting to get a bit desperate.
Comment 1 Tor Lillqvist 2002-04-24 08:22:17 UTC
Created attachment 7908 [details]
Test program
Comment 2 Owen Taylor 2002-04-24 14:23:48 UTC
Relate to?

Tue Feb  5 19:13:42 2002  Owen Taylor  <otaylor@redhat.com>

	* gdk/x11/gdkgeometry-x11.c (gdk_window_queue): Keep
	the length of the anti-expose queue finite, by if
	it gets too long, first doing a XSync() and checking
	the event queue, and if that doesn't work, simply
	discarding all anti-expose items in the queue.

I'm not sure that it makes sense for the win32 port to have
an anti-expose queue at all, but if it does, it probably
needs a similar fix.
Comment 3 Tor Lillqvist 2002-04-24 22:43:56 UTC
BTW, in _gdk_window_process_expose(), should the 
  queue_delete_link (translate_queue, translate_queue->head);
be 
  queue_delete_link (translate_queue, the queue item being handled); ?

Or at least, maybe some comment about what's happening would be 
helpful... Is there an assumption here about the ordering of items in 
serial order or something?
Comment 4 Owen Taylor 2002-05-01 15:11:47 UTC
the items in the queue have item->serial always non-decreasing,
(new items are appended to the queue, and the result of NextRequest
increases) so once if (serial < item->serial) fails, it will always 
fails. In other words, the deleted items are always at the beginning
of the queue so the code works fine.

I guess NextRequest would wrap around after GTK+ makes 4 billion
X calls... perhaps this code needs to deal with that, since
it will blow up badly when that happens... and it's not inconceivable
an app might make thousands of drawing calls a second for several
months. 

But other than that that, it's fine.
Comment 5 Reade Rintoul 2002-08-08 14:59:10 UTC
Created attachment 10367 [details]
small example that leaks memory in gtk_widget_queue_draw
Comment 6 Tor Lillqvist 2002-08-24 22:12:06 UTC
Tentative fix (by Florent Duquet) applied to gtk-2-0.
Comment 7 Tor Lillqvist 2002-09-11 21:23:39 UTC
Same fix applied to HEAD, too.
Comment 8 Tor Lillqvist 2002-11-16 23:01:08 UTC
translate_queue concept now removed from Win32 backend in both HEAD 
and gtk-2-0, as part of work on screen update bugs that were most 
visible in scrolling in testgtk and gtk-demo. The test programs no 
longer leak memory.