Hi,

2010/10/12 Tue 15:46:39 UTC+9 Sergey Khorev:
> Christian Brabandt <cblists <at> 256bit.org> writes:
> 
> > I see that on Windows XP with Vim 7.2.284 after approximately 20000
> > iterations. But what is really weird is, that the whole gui is broken
> > afterwards. The window is not redrawn correctly afterwards and when typing
> > the letters appear in the root window (e.g. it looks like I am typing
> > on the Desktop of Windows itsself) and all different artifacts are drawn
> > on the screen. Even after quitting vim, I still see some artifacts.
> > Very weird.
> 
> It's not weird, these are symptoms of the same problem: Vim leaks GUI 
> resources 
> (you can enable monitoring of GDI objects in task manager and see them 
> increasing until they reach 10000). Apparently Vim creates new font for each 
> iteration and does not destroy created fonts.

I think I found the cause of this resource leak problem.
The leak occurs in hl_do_font() (syntax.c).
Attached patch fixes the problem. I tested it on Windows 7 and
bug.vim worked fine.

(Sorry if I posted this message twice.)

Best regards,
Ken Takata

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
# HG changeset patch
# Parent 67bcd9f526db84be7f61dd328824bf5211c821b9
fix font resource leak

see:
  https://groups.google.com/d/topic/vim_dev/-TJM3cfWIDQ/discussion

  todo.txt
> Highlighting stops working after changing it many times.  Script to reproduce
> it: Pablo Contreras, 2010 Oct 12  Windows XP and 7.  Font is never freed?

diff --git a/src/syntax.c b/src/syntax.c
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -8126,6 +8126,8 @@
     else
 # endif
     {
+	if (HL_TABLE()[idx].sg_font != NOFONT)
+	    gui_mch_free_font(HL_TABLE()[idx].sg_font);
 	HL_TABLE()[idx].sg_font = font_name2handle(arg);
 	/* If it worked and it's the Normal group, use it as the
 	 * normal font.  Same for the Menu group. */

Raspunde prin e-mail lui