emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

memory leak with bdf fonts


From: NAKAMURA Toshikazu
Subject: memory leak with bdf fonts
Date: Thu, 19 Aug 2004 20:00:10 +0900
User-agent: Wanderlust/2.11.30 (Wonderwall) Emacs/21.3 Mule/5.0 (SAKAKI)

When I use bdf fonts with CVS emacs on MS Windows, it consumes an
inordinate amount of memory even up to several hundreds MB and gets
extremely slow. It usually consumes much less than half a hundred MB
when I use Windows true type fonts, memory leaks must be suspected.

I am using intlfonts 1.2.1 with the following setting:

(setq w32-bdf-filename-alist
      (w32-find-bdf-fonts '("d:/usr/local/emacs/fonts/bdf")))

(create-fontset-from-fontset-spec
 "-*-fixed-medium-r-normal-*-16-*-*-*-c-*-fontset-bdf,
 latin-jisx0201:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0201*-*,
 katakana-jisx0201:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0201*-*,
 japanese-jisx0208:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0208.1983-*,
 japanese-jisx0208-1978:-*-*-medium-r-normal-*-16-*-*-*-c-*-jisx0208.1978-*,
 japanese-jisx0212:-*-*-medium-r-normal--16-*-*-*-c-*-JISX0212.1990-0")

(setq font-encoding-alist
      (append '(("JISX0208"      (japanese-jisx0208 . 0))
                ("JISX0208.1978" (japanese-jisx0208-1978 . 0))
                ("JISX0212"      (japanese-jisx0212 . 0)))
              font-encoding-alist))

Though I am not sure about other non-Latin fonts (Japanese is the only
non-Latin language that I use), in my environment it looks like memory
leaks do not occur unless Japanese fonts are used.

When I asked for information, someone (anonymous) wrote a patch for me
and it seems to have worked fine. Though he said that he was not sure
if it is the right fix, he kindly allowed me to use it freely. Since I
am no expert, I just send the patch for your consideration.

OS: Microsoft Windows 2000 5.00.2195 Service Pack 4
PC: x86 Family 6 Model 8 Stepping 3 PC/AT COMPATIBLE 391,712 KB RAM



In GNU Emacs 21.3.50.1 (i386-mingw-nt5.0.2195)
 of 2004-08-18 on VAIO
configured using `configure --with-gcc (3.2)'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: JPN
  locale-coding-system: cp932
  default-enable-multibyte-characters: t

Major mode: Lisp Int

Minor modes in effect:
  delete-selection-mode: t
  show-paren-mode: t
  auto-image-file-mode: t
  encoded-kbd-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

-- 
NAKAMURA Toshikazu <address@hidden>

===File ~/tmp/w32fns.c.patch================================
*** w32fns.c_orig       Tue Aug 17 22:19:32 2004
--- w32fns.c    Tue Aug 17 22:26:21 2004
***************
*** 4642,4656 ****
  {
    Lisp_Object bdf_fonts;
    struct font_info *retval = NULL;
  
    bdf_fonts = w32_list_bdf_fonts (build_string (fontname), 1);
  
    while (!retval && CONSP (bdf_fonts))
      {
        char *bdf_name, *bdf_file;
        Lisp_Object bdf_pair;
- 
        bdf_name = SDATA (XCAR (bdf_fonts));
        bdf_pair = Fassoc (XCAR (bdf_fonts), Vw32_bdf_filename_alist);
        bdf_file = SDATA (XCDR (bdf_pair));
  
--- 4642,4665 ----
  {
    Lisp_Object bdf_fonts;
    struct font_info *retval = NULL;
+   struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
  
    bdf_fonts = w32_list_bdf_fonts (build_string (fontname), 1);
  
    while (!retval && CONSP (bdf_fonts))
      {
+               int i;
        char *bdf_name, *bdf_file;
        Lisp_Object bdf_pair;
        bdf_name = SDATA (XCAR (bdf_fonts));
+ 
+               for (i = 0; i < dpyinfo->n_fonts; i++)
+               {
+                       if (dpyinfo->font_table[i].name && (!strcmp 
(dpyinfo->font_table[i].name, bdf_name))
+                                                                               
                || !strcmp (dpyinfo->font_table[i].full_name, bdf_name))
+                                       return dpyinfo->font_table + i;
+               }
+ 
        bdf_pair = Fassoc (XCAR (bdf_fonts), Vw32_bdf_filename_alist);
        bdf_file = SDATA (XCDR (bdf_pair));
  
============================================================




reply via email to

[Prev in Thread] Current Thread [Next in Thread]