From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#66096: High CPU usage, basically runaway emacs with visit to bidi_cache_search on and off? Date: Wed, 20 Sep 2023 16:24:35 +0300 Message-ID: <83o7hxasfg.fsf@gnu.org> References: <1808d5a1-3ee6-d675-3ad3-c6bcc2fe5e36@yk.rim.or.jp> <834jjqe85z.fsf@gnu.org> <80682fbe-b5ac-4605-b8e5-7baac2d71da5@yk.rim.or.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12314"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 66096@debbugs.gnu.org To: "ISHIKAWA,chiaki" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 20 15:25:15 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qixCc-0002uM-Vo for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 20 Sep 2023 15:25:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qixCJ-0005Si-9s; Wed, 20 Sep 2023 09:24:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qixCH-0005SZ-2f for bug-gnu-emacs@gnu.org; Wed, 20 Sep 2023 09:24:53 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qixCG-0002y6-Qh for bug-gnu-emacs@gnu.org; Wed, 20 Sep 2023 09:24:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qixCP-0004D1-NS for bug-gnu-emacs@gnu.org; Wed, 20 Sep 2023 09:25:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 Sep 2023 13:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66096 X-GNU-PR-Package: emacs Original-Received: via spool by 66096-submit@debbugs.gnu.org id=B66096.169521629016153 (code B ref 66096); Wed, 20 Sep 2023 13:25:01 +0000 Original-Received: (at 66096) by debbugs.gnu.org; 20 Sep 2023 13:24:50 +0000 Original-Received: from localhost ([127.0.0.1]:58552 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qixCD-0004CT-Ia for submit@debbugs.gnu.org; Wed, 20 Sep 2023 09:24:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42722) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qixCC-0004CF-Ae for 66096@debbugs.gnu.org; Wed, 20 Sep 2023 09:24:49 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qixBv-0002wR-PQ; Wed, 20 Sep 2023 09:24:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=srTQtSbzN/Nr13Panpl0EYlSv320z9AGJI9tQftSYKc=; b=jL2RSMvTJN7jy0hodY6y 1zsf/XfBLKJmcz44kqMedFytZk7cWsO9IoiDb9XhWAo5enwcWHh5QYAfthiEg5vS6eLFjWrDlYMb2 mjU/bcFmgGUDLz04Eco+fdzf8h2J1+KBS4/gPg6V1sgEJztNCPyFtr3IFJW4X8zzdF0Np3igrvjZh NSh/E6HWqOF9jnBxSkUiu+UtBBvvS5gfnGx4kW+833EWcD5VUeDbHJBQbHC6MoEFwALZFk61VvStM OgcqyW7HGIr/ThW1k+T3G2cibog65KfGNBPMtyP7ydHiw1CS8vn4nYGMWVJlj16tI/dKiuVZkbgrH C+7ZrsowoKmUbw==; In-Reply-To: <80682fbe-b5ac-4605-b8e5-7baac2d71da5@yk.rim.or.jp> (ishikawa@yk.rim.or.jp) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:270923 Archived-At: > Date: Wed, 20 Sep 2023 16:09:03 +0900 > Cc: 66096@debbugs.gnu.org, "ishikawa, chiaki" > From: "ISHIKAWA,chiaki" > > I have the following code snippet to monitor GC issues on my PC for > quite sometime. > But I have not seen this particular problem before. > The long pause I have seen before was strictly in GC-related routines. > > (setq my-gc-statistics (make-vector 30 nil)) > > ;;; The element is > ;;; (append (memory-use-counts) (list gc-elapsed gcs-done)) > ;;; Each time the following function is called, the > ;;; elements in the array is shifted toward the end. > ;;; Use (message "%S" my-gc-statistics) to force the > ;;; recording of my-gc-statistics value in *Messages* buffer for later > analysis. > > > (defun update-my-gc-statistics () >   (let ((i 28)) >     (progn >      ;;; very unlike Lisp >      (while (<= 0 i) >        (progn (aset my-gc-statistics (+ 1 i) (aref my-gc-statistics i)) >              (setq i (- i 1) ))) >      (aset my-gc-statistics 0 >            (append (memory-use-counts) (list gc-elapsed gcs-done))) >      ;;; print the latest one last so that I can see the glimpse in the > narrow >      ;;; output window. >      (message "%S\n%S" (current-time-string) (pp (reverse > my-gc-statistics)))))) > > (setq post-gc-hook 'update-my-gc-statistics) > > For example, in one place, I see > #0  0x0000556f1905be9e in string_char_and_length >     (length=, p=0x556f20d8a3d8 " 70337 417360 > 2.323839139 50)\n (99058573 3875 59193441 34949 11084445 70337 417401 > 2.391973008 51)]\n\"") at > /home/ishikawa/repos/emacs-29.1/src/character.h:375 > > And that string is probably   from (append (memory-use-counts) (list > gc-elapsed gcs-done)) I tried to run with this, and I don't see any such infloop. I see the GC results displayed in the echo-area once in a while. I guess some other customizations cause this, or maybe some special circumstances with different fonts you use. Customizations that affect the echo-area display and resizing are of main interest. If you can try to reproduce this in "emacs -Q", with only the post-gc-hook defined and as little of your other customizations as possible, it could help. > Also I see recursive_edit at the bottom of the stakctrace. > Not sure why. Maybe I was doing some error recovery of Japanese input? No, this is normal: Emacs enters one level of recursive-edit when it starts.