GNU bug report logs - #14850
24.3; GDI Handles leak(Windows)

Previous Next

Package: emacs;

Reported by: Akihiro KAYAMA <kayama <at> tiresia.org>

Date: Fri, 12 Jul 2013 15:16:02 UTC

Severity: normal

Found in version 24.3

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #16 received at 14850-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Akihiro KAYAMA <kayama.akihiro <at> gmail.com>
Cc: 14850-done <at> debbugs.gnu.org
Subject: Re: bug#14850: 24.3; GDI Handles leak(Windows)
Date: Sun, 14 Jul 2013 19:06:47 +0300
> Date: Sun, 14 Jul 2013 18:55:24 +0900
> From: Akihiro KAYAMA <kayama.akihiro <at> gmail.com>
> Cc: 14850 <at> debbugs.gnu.org
> 
> I understand you can't reproduce GDI Handles leak. Just to make sure,
> I mention again three requiremetns fot it.
> 
>  - multiple frames
>  - continuous shell buffer output(maybe mode line updates)
>  - mini buffer

Actually, I think I did succeed to reproduce this.  Here's a much
easier method, for the record:

  emacs -Q
  M-x make-frame-command RET
  M-: (require 'time) RET
  M-: (setq display-time-interval 1) RET
  M-: (setq display-time-format "%H:%M:%S") RET
  M-x display-time RET
  C-x C-f

As long as Emacs sits at the minibuffer prompt, you'll have a GDI
handle leaked once every second, according to display-time-interval.
Type C-g to get out of the minibuffer, and the leak stops.

IOW, the conditions for this are:

 . more than 1 frame

 . active minibuffer prompt, and

 . continuous redisplay

According to my measurements, the change I made in revision 113415
completely stops GDI handle leak in this scenario, and also in your
original one.  So I will close this bug; feel free to reopen if you
can still come up with a scenario where GDI objects are leaked.

The changes I committed are below, for your convenience.

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2013-07-13 10:29:15 +0000
+++ src/ChangeLog	2013-07-13 14:21:01 +0000
@@ -1,5 +1,8 @@
 2013-07-13  Eli Zaretskii  <eliz <at> gnu.org>
 
+	* w32term.c (x_draw_hollow_cursor): Delete the brush object when
+	returning early.  (Bug#14850)
+
 	* coding.c (syms_of_coding): Set up inhibit-null-byte-detection
 	and inhibit-iso-escape-detection attributes of 'undecided'.
 	(Bug#14822)

=== modified file 'src/w32term.c'
--- src/w32term.c	2013-07-06 02:40:50 +0000
+++ src/w32term.c	2013-07-13 14:21:01 +0000
@@ -5174,7 +5174,10 @@ x_draw_hollow_cursor (struct window *w, 
      the current matrix is invalid or such, give up.  */
   cursor_glyph = get_phys_cursor_glyph (w);
   if (cursor_glyph == NULL)
-    return;
+    {
+      DeleteObject (hb);
+      return;
+    }
 
   /* Compute frame-relative coordinates for phys cursor.  */
   get_phys_cursor_geometry (w, row, cursor_glyph, &left, &top, &h);





This bug report was last modified 11 years and 315 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.