emacs-devel
[Top][All Lists]
Advanced

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

Re: Debugging emacs memory management


From: Dima Kogan
Subject: Re: Debugging emacs memory management
Date: Mon, 05 Oct 2015 02:49:11 -0700

Dima Kogan <address@hidden> writes:

> Making copy_font_spec() a deep copy probably would resolve this.
> Trying that now.

Aaand, that works. The leak went down from 24KB/frame to 12KB/frame.
Patch below. I'm not as familiar with lisp as I should probably be, so
there's probably a nicer way for this patch to have been written.


diff --git a/src/font.c b/src/font.c
index 8e06532..ca872d0 100644
--- a/src/font.c
+++ b/src/font.c
@@ -3981,7 +3981,15 @@ copy_font_spec (Lisp_Object font)
   pcdr = spec->props + FONT_EXTRA_INDEX;
   for (tail = AREF (font, FONT_EXTRA_INDEX); CONSP (tail); tail = XCDR (tail))
     if (!EQ (XCAR (XCAR (tail)), QCfont_entity))
-      *pcdr = Fcons (XCAR (tail), Qnil), pcdr = xcdr_addr (*pcdr);
+      {
+        if (CONSP (XCAR (tail)))
+          *pcdr = Fcons (Fcons( XCAR (XCAR (tail)),
+                                XCDR (XCAR (tail))),
+                         Qnil);
+        else
+          *pcdr = Fcons (XCAR (tail), Qnil);
+        pcdr = xcdr_addr (*pcdr);
+      }
 
   XSETFONT (new_spec, spec);
   return new_spec;



reply via email to

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