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

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

Re: fontification loop


From: Andreas Seltenreich
Subject: Re: fontification loop
Date: Mon, 25 Sep 2006 18:13:38 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> I just caught Emacs hogging the CPU with endless
>> redisplay/fontification.  The following code triggers it for me:
>
>> --8<---------------cut here---------------start------------->8---
>> (progn
>>   (switch-to-buffer "*fontification loop*")
>>   (emacs-lisp-mode)
>>   (while (< (point) (floor (* (sqrt 2) jit-lock-chunk-size)))
>>     (insert "\nfoo\nbar\nbaz"))
>>   (put-text-property (- (point-max) 5) (point-max) 'invisible t))
>> --8<---------------cut here---------------end--------------->8---
>
>> If emacs crashed, and you have the emacs process in the gdb debugger,
>> please include the output from the following gdb commands:
>>     `bt full' and `xbacktrace'.
>> If you would like to further debug the crash, please read the file
>> /home/andreas/ext/emacs/etc/DEBUG for instructions.
>
> I can't reproduce it here.  Does the patch below help?

I've patched and compiled jit-lock.el and dumped a new emacs.

Curiously, I can no longer trigger the CPU hogging with the code
/above/, /but/ it occurs again as soon as I use trace-function like
this:

--8<---------------cut here---------------start------------->8---
(require 'elp)
(defun trace-package (prefix)
  "Instrument for tracing, all functions which start with PREFIX.
For example, to instrument all font-lock functions, do the following:

    \\[trace-package] RET font-lock- RET"
  (interactive
   (list (completing-read "Prefix of package to instrument: "
                          obarray 'elp-profilable-p)))
  (if (zerop (length prefix))
      (error "Instrumenting all Emacs functions would render Emacs unusable"))
  (mapc 'trace-function-background
        (mapcar
         'intern
         (all-completions prefix obarray 'elp-profilable-p))))

(progn
  (mapc 'trace-package '("font-lock" "jit-lock"))
  (progn
    (switch-to-buffer "*fontification loop*")
    (emacs-lisp-mode)
    (while (< (point) (floor (* (sqrt 2) jit-lock-chunk-size)))
      (insert "\nfoo\nbar\nbaz"))
    (put-text-property (- (point-max) 5) (point-max) 'invisible t)
    )
  (sit-for 0.5)
  (untrace-all)
  (font-lock-mode 0))
--8<---------------cut here---------------end--------------->8---

Maybe the problem has a race-condition nature?

regards,
andreas




reply via email to

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