GNU bug report logs - #70796
30.0.50; bug-reference-mode leading to constant GCing

Previous Next

Package: emacs;

Reported by: Gerd Möllmann <gerd.moellmann <at> gmail.com>

Date: Mon, 6 May 2024 06:55:01 UTC

Severity: normal

Found in version 30.0.50

To reply to this bug, email your comments to 70796 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#70796; Package emacs. (Mon, 06 May 2024 06:55:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gerd Möllmann <gerd.moellmann <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 06 May 2024 06:55:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; bug-reference-mode leading to constant GCing
Date: Mon, 06 May 2024 08:53:29 +0200
This is in an Emacs compiled from the branch scratch/igc, but I see the
same in master.

When loading admin/igc.org in scratch/igc I see very frequent GC, even
while doing nothing at all. Memory profiler shows this

  4,192,076,326  68% - redisplay_internal (C function)
  2,997,520,400  48%  - jit-lock-function
  2,997,520,400  48%   - jit-lock-fontify-now
  2,982,457,616  48%    - jit-lock--run-functions
  2,982,457,616  48%     - run-hook-wrapped
  2,982,457,616  48%      - #<compiled-function 8A7>
  2,769,181,376  45%       - font-lock-fontify-region
  2,769,181,376  45%        - font-lock-default-fontify-region
  2,707,362,176  44%         - font-lock-fontify-keywords-region
    276,400,512   4%          + org-do-emphasis-faces
    197,821,440   3%          + org-fontify-drawers
    197,821,440   3%          + org-activate-links
    197,821,440   3%          + org-activate-tags
    197,821,440   3%          + org-activate-dates
    197,821,440   3%          + org-activate-footnote-links
    197,821,440   3%          + org-fontify-macros
    197,821,440   3%          + org-font-lock-add-priority-faces
    197,821,440   3%          + org-do-latex-and-related
    197,821,440   3%          + org-activate-code
    197,821,440   3%          + org-fontify-meta-lines-and-blocks
    197,821,440   3%          + org-fontify-inline-src-blocks
    197,821,440   3%          + org-cite-activate
     57,104,384   0%            re-search-forward
     61,819,200   1%         + font-lock-unfontify-region
    213,276,240   3%       + bug-reference-fontify
     15,062,784   0%    - run-with-timer
     15,062,784   0%     + apply
         97,280   0%  + file-remote-p
            336   0%  + desktop-auto-save-set-timer
            144   0%  + tab-bar-make-keymap
  1,955,072,562  31% + command-execute
        129,456   0% + timer-event-handler
          1,024   0% + corfu--auto-post-command
              0   0%   ...

Disabling bug-reference-mode in the Org buffer makes it stop constantly
GCing.

In GNU Emacs 30.0.50 (build 4, aarch64-apple-darwin23.4.0, NS
 appkit-2487.50 Version 14.4.1 (Build 23E224)) of 2024-05-06 built on
 pro2.fritz.box
Repository revision: 5067d5484f80ac39d9aa57bd53343e335b744003
Repository branch: scratch/igc
Windowing system distributor 'Apple', version 10.3.2487
System Description:  macOS 14.4.1


Configured using:
 'configure --cache-file
 /var/folders/1d/k_6t25f94sl83szqbf8gpkrh0000gn/T//config.cache.igc
 --with-native-compilation=no --with-mps=yes CC=clang'




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70796; Package emacs. (Mon, 06 May 2024 11:50:01 GMT) Full text and rfc822 format available.

Message #8 received at 70796 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: 70796 <at> debbugs.gnu.org
Subject: Re: bug#70796: 30.0.50; bug-reference-mode leading to constant GCing
Date: Mon, 06 May 2024 14:48:29 +0300
> From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
> Date: Mon, 06 May 2024 08:53:29 +0200
> 
> This is in an Emacs compiled from the branch scratch/igc, but I see the
> same in master.
> 
> When loading admin/igc.org in scratch/igc I see very frequent GC, even
> while doing nothing at all. Memory profiler shows this
> 
>   4,192,076,326  68% - redisplay_internal (C function)
>   2,997,520,400  48%  - jit-lock-function
>   2,997,520,400  48%   - jit-lock-fontify-now
>   2,982,457,616  48%    - jit-lock--run-functions
>   2,982,457,616  48%     - run-hook-wrapped
>   2,982,457,616  48%      - #<compiled-function 8A7>
>   2,769,181,376  45%       - font-lock-fontify-region
>   2,769,181,376  45%        - font-lock-default-fontify-region
>   2,707,362,176  44%         - font-lock-fontify-keywords-region
>     276,400,512   4%          + org-do-emphasis-faces
>     197,821,440   3%          + org-fontify-drawers
>     197,821,440   3%          + org-activate-links
>     197,821,440   3%          + org-activate-tags
>     197,821,440   3%          + org-activate-dates
>     197,821,440   3%          + org-activate-footnote-links
>     197,821,440   3%          + org-fontify-macros
>     197,821,440   3%          + org-font-lock-add-priority-faces
>     197,821,440   3%          + org-do-latex-and-related
>     197,821,440   3%          + org-activate-code
>     197,821,440   3%          + org-fontify-meta-lines-and-blocks
>     197,821,440   3%          + org-fontify-inline-src-blocks
>     197,821,440   3%          + org-cite-activate
>      57,104,384   0%            re-search-forward
>      61,819,200   1%         + font-lock-unfontify-region
>     213,276,240   3%       + bug-reference-fontify
>      15,062,784   0%    - run-with-timer
>      15,062,784   0%     + apply
>          97,280   0%  + file-remote-p
>             336   0%  + desktop-auto-save-set-timer
>             144   0%  + tab-bar-make-keymap
>   1,955,072,562  31% + command-execute
>         129,456   0% + timer-event-handler
>           1,024   0% + corfu--auto-post-command
>               0   0%   ...

Where's the evidence of "frequent GC" in this profile?

(And "memory profile" has nothing to do with memory usage, contrary to
popular belief.)

> Disabling bug-reference-mode in the Org buffer makes it stop constantly
> GCing.

I believe you.  But showing the number of GCs (e.g., using the
variable gcs-done) would tell us the story more convincingly.
Alternatively, if you can share an Org file where this could be seen,
please do.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70796; Package emacs. (Mon, 06 May 2024 12:37:02 GMT) Full text and rfc822 format available.

Message #11 received at 70796 <at> debbugs.gnu.org (full text, mbox):

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 70796 <at> debbugs.gnu.org
Subject: Re: bug#70796: 30.0.50; bug-reference-mode leading to constant GCing
Date: Mon, 06 May 2024 14:35:42 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
>> Date: Mon, 06 May 2024 08:53:29 +0200
>> 
>> This is in an Emacs compiled from the branch scratch/igc, but I see the
>> same in master.
>> 
>> When loading admin/igc.org in scratch/igc I see very frequent GC, even
>> while doing nothing at all. Memory profiler shows this
>> 
>>   4,192,076,326  68% - redisplay_internal (C function)
>>   2,997,520,400  48%  - jit-lock-function
>>   2,997,520,400  48%   - jit-lock-fontify-now
>>   2,982,457,616  48%    - jit-lock--run-functions
>>   2,982,457,616  48%     - run-hook-wrapped
>>   2,982,457,616  48%      - #<compiled-function 8A7>
>>   2,769,181,376  45%       - font-lock-fontify-region
>>   2,769,181,376  45%        - font-lock-default-fontify-region
>>   2,707,362,176  44%         - font-lock-fontify-keywords-region
>>     276,400,512   4%          + org-do-emphasis-faces
>>     197,821,440   3%          + org-fontify-drawers
>>     197,821,440   3%          + org-activate-links
>>     197,821,440   3%          + org-activate-tags
>>     197,821,440   3%          + org-activate-dates
>>     197,821,440   3%          + org-activate-footnote-links
>>     197,821,440   3%          + org-fontify-macros
>>     197,821,440   3%          + org-font-lock-add-priority-faces
>>     197,821,440   3%          + org-do-latex-and-related
>>     197,821,440   3%          + org-activate-code
>>     197,821,440   3%          + org-fontify-meta-lines-and-blocks
>>     197,821,440   3%          + org-fontify-inline-src-blocks
>>     197,821,440   3%          + org-cite-activate
>>      57,104,384   0%            re-search-forward
>>      61,819,200   1%         + font-lock-unfontify-region
>>     213,276,240   3%       + bug-reference-fontify
>>      15,062,784   0%    - run-with-timer
>>      15,062,784   0%     + apply
>>          97,280   0%  + file-remote-p
>>             336   0%  + desktop-auto-save-set-timer
>>             144   0%  + tab-bar-make-keymap
>>   1,955,072,562  31% + command-execute
>>         129,456   0% + timer-event-handler
>>           1,024   0% + corfu--auto-post-command
>>               0   0%   ...
>
> Where's the evidence of "frequent GC" in this profile?

I didn't say the profile is evidence of frequent GCs.

> (And "memory profile" has nothing to do with memory usage, contrary to
> popular belief.)
>
>> Disabling bug-reference-mode in the Org buffer makes it stop constantly
>> GCing.
>
> I believe you.  But showing the number of GCs (e.g., using the
> variable gcs-done) would tell us the story more convincingly.
> Alternatively, if you can share an Org file where this could be seen,
> please do.

So, believe me. Or not, as you please. I said where the Org file is at
the beginning.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70796; Package emacs. (Mon, 06 May 2024 14:05:02 GMT) Full text and rfc822 format available.

Message #14 received at 70796 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>,
 Ihor Radchenko <yantar92 <at> posteo.net>
Cc: 70796 <at> debbugs.gnu.org
Subject: Re: bug#70796: 30.0.50; bug-reference-mode leading to constant GCing
Date: Mon, 06 May 2024 17:03:22 +0300
> From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
> Cc: 70796 <at> debbugs.gnu.org
> Date: Mon, 06 May 2024 14:35:42 +0200
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > Where's the evidence of "frequent GC" in this profile?
> 
> I didn't say the profile is evidence of frequent GCs.
> 
> > (And "memory profile" has nothing to do with memory usage, contrary to
> > popular belief.)
> >
> >> Disabling bug-reference-mode in the Org buffer makes it stop constantly
> >> GCing.
> >
> > I believe you.  But showing the number of GCs (e.g., using the
> > variable gcs-done) would tell us the story more convincingly.
> > Alternatively, if you can share an Org file where this could be seen,
> > please do.
> 
> So, believe me. Or not, as you please. I said where the Org file is at
> the beginning.

Ah, okay, sorry for missing that.

I tried to scroll through that with Emacs 30 from master, and here's
the CPU profile:

          20  74%   Automatic GC
           4  14% - command-execute
           4  14%  - call-interactively
           2   7%   - funcall-interactively
           2   7%    - scroll-up-command
           2   7%       scroll-up
           2   7%   - byte-code
           2   7%    - read-extended-command
           2   7%     - read-extended-command-1
           2   7%      - completing-read
           2   7%       - completing-read-default
           2   7%        - read-from-minibuffer
           2   7%           redisplay_internal (C function)
           3  11%   redisplay_internal (C function)
           0   0%   ...

I get roughly one GC cycle per full scroll top to bottom.
Interestingly, bug-reference-fontify is not in the profile, perhaps
because it's lower-resolution than on your system with "memory"
profiler.

And here's the profile with bug-reference-mode turned off:

          15  48%   Automatic GC
           8  25%   redisplay_internal (C function)
           8  25% - command-execute
           8  25%  - call-interactively
           4  12%   - funcall-interactively
           3   9%    - scroll-down-command
           3   9%       scroll-down
           1   3%    - scroll-up-command
           1   3%       scroll-up
           4  12%   - byte-code
           3   9%    - read--expression
           3   9%     - read-from-minibuffer
           2   6%        redisplay_internal (C function)
           1   3%    - read-extended-command
           1   3%     - read-extended-command-1
           1   3%      - completing-read
           1   3%       - completing-read-default
           1   3%        - read-from-minibuffer
           1   3%           redisplay_internal (C function)
           0   0%   ...

This does fewer GCs (about 75% of what I see with bug-reference-mode
turned ON), but not by a large factor.

Looking at bug-reference-fontify, I see that it conses a string -- but
it only does that when it finds a match for bug-reference-bug-regexp,
and there are no such matches in igc.org on the branch, AFAICT.

So I'm not sure which part(s) of bug-reference.el make a lot of
garbage, or why.

Ihor, any ideas?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70796; Package emacs. (Mon, 06 May 2024 14:10:02 GMT) Full text and rfc822 format available.

Message #17 received at 70796 <at> debbugs.gnu.org (full text, mbox):

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Ihor Radchenko <yantar92 <at> posteo.net>, 70796 <at> debbugs.gnu.org
Subject: Re: bug#70796: 30.0.50; bug-reference-mode leading to constant GCing
Date: Mon, 06 May 2024 16:09:00 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> So I'm not sure which part(s) of bug-reference.el make a lot of
> garbage, or why.

This maybe completely wrong, but my suspicion was that bug-reference
somehow triggers Org fontification, which creates more garbage. If
that's possible...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70796; Package emacs. (Tue, 07 May 2024 07:00:02 GMT) Full text and rfc822 format available.

Message #20 received at 70796 <at> debbugs.gnu.org (full text, mbox):

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Ihor Radchenko <yantar92 <at> posteo.net>, 70796 <at> debbugs.gnu.org
Subject: Re: bug#70796: 30.0.50; bug-reference-mode leading to constant GCing
Date: Tue, 07 May 2024 08:58:46 +0200
Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>> So I'm not sure which part(s) of bug-reference.el make a lot of
>> garbage, or why.
>
> This maybe completely wrong, but my suspicion was that bug-reference
> somehow triggers Org fontification, which creates more garbage. If
> that's possible...

Maybe bug-reference-fontify should return a list (jit-lock-bounds beg
end)? Looks to me like if it doesn't we could end up fontifying the
whole buffer for Org. See jit-lock--run-functions.

Not sure but the behaviour looks like somethign like that could be
happening.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70796; Package emacs. (Sat, 18 May 2024 06:29:01 GMT) Full text and rfc822 format available.

Message #23 received at 70796 <at> debbugs.gnu.org (full text, mbox):

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Ihor Radchenko <yantar92 <at> posteo.net>, 70796 <at> debbugs.gnu.org
Subject: Re: bug#70796: 30.0.50; bug-reference-mode leading to constant GCing
Date: Sat, 18 May 2024 08:27:15 +0200
Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:

> Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:
>
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>>
>>> So I'm not sure which part(s) of bug-reference.el make a lot of
>>> garbage, or why.
>>
>> This maybe completely wrong, but my suspicion was that bug-reference
>> somehow triggers Org fontification, which creates more garbage. If
>> that's possible...
>
> Maybe bug-reference-fontify should return a list (jit-lock-bounds beg
> end)? Looks to me like if it doesn't we could end up fontifying the
> whole buffer for Org. See jit-lock--run-functions.
>
> Not sure but the behaviour looks like somethign like that could be
> happening.

Ping




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70796; Package emacs. (Sat, 18 May 2024 08:09:02 GMT) Full text and rfc822 format available.

Message #26 received at 70796 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>, Tassilo Horn
 <tsdh <at> gnu.org>
Cc: yantar92 <at> posteo.net, 70796 <at> debbugs.gnu.org
Subject: Re: bug#70796: 30.0.50; bug-reference-mode leading to constant GCing
Date: Sat, 18 May 2024 11:07:50 +0300
> From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
> Cc: Ihor Radchenko <yantar92 <at> posteo.net>,  70796 <at> debbugs.gnu.org
> Date: Sat, 18 May 2024 08:27:15 +0200
> 
> Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:
> 
> > Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:
> >
> >> Eli Zaretskii <eliz <at> gnu.org> writes:
> >>
> >>> So I'm not sure which part(s) of bug-reference.el make a lot of
> >>> garbage, or why.
> >>
> >> This maybe completely wrong, but my suspicion was that bug-reference
> >> somehow triggers Org fontification, which creates more garbage. If
> >> that's possible...
> >
> > Maybe bug-reference-fontify should return a list (jit-lock-bounds beg
> > end)? Looks to me like if it doesn't we could end up fontifying the
> > whole buffer for Org. See jit-lock--run-functions.
> >
> > Not sure but the behaviour looks like somethign like that could be
> > happening.
> 
> Ping

Tassilo, could you please take a look at this?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70796; Package emacs. (Sat, 18 May 2024 15:50:02 GMT) Full text and rfc822 format available.

Message #29 received at 70796 <at> debbugs.gnu.org (full text, mbox):

From: "Tassilo Horn" <tsdh <at> gnu.org>
To: "Eli Zaretskii" <eliz <at> gnu.org>,
 Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: yantar92 <at> posteo.net, 70796 <at> debbugs.gnu.org
Subject: Re: bug#70796: 30.0.50; bug-reference-mode leading to constant GCing
Date: Sat, 18 May 2024 17:49:15 +0200
Hi all,

it's the first day of my vacation so I'm away from the computer until next Saturday evening at best. But then I'll have a look. 

Bye, 
Tassilo 

Am Sa, 18. Mai 2024, um 10:07, schrieb Eli Zaretskii:
>> From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
>> Cc: Ihor Radchenko <yantar92 <at> posteo.net>,  70796 <at> debbugs.gnu.org
>> Date: Sat, 18 May 2024 08:27:15 +0200
>> 
>> Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:
>> 
>> > Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:
>> >
>> >> Eli Zaretskii <eliz <at> gnu.org> writes:
>> >>
>> >>> So I'm not sure which part(s) of bug-reference.el make a lot of
>> >>> garbage, or why.
>> >>
>> >> This maybe completely wrong, but my suspicion was that bug-reference
>> >> somehow triggers Org fontification, which creates more garbage. If
>> >> that's possible...
>> >
>> > Maybe bug-reference-fontify should return a list (jit-lock-bounds beg
>> > end)? Looks to me like if it doesn't we could end up fontifying the
>> > whole buffer for Org. See jit-lock--run-functions.
>> >
>> > Not sure but the behaviour looks like somethign like that could be
>> > happening.
>> 
>> Ping
>
> Tassilo, could you please take a look at this?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70796; Package emacs. (Fri, 24 May 2024 20:01:02 GMT) Full text and rfc822 format available.

Message #32 received at 70796 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Gerd Möllmann <gerd.moellmann <at> gmail.com>,
 yantar92 <at> posteo.net, 70796 <at> debbugs.gnu.org
Subject: Re: bug#70796: 30.0.50; bug-reference-mode leading to constant GCing
Date: Fri, 24 May 2024 22:00:00 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

Hi all,

I'm back and had a look at this issue.

>> > Maybe bug-reference-fontify should return a list (jit-lock-bounds
>> > beg end)?

Indeed, that's what I'm doing now.  I'm not entirely sure if that fixes
the GC issue but it's certainly a good idea anyhow.

Please report back if it helps.

Thanks,
  Tassilo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70796; Package emacs. (Fri, 24 May 2024 20:21:01 GMT) Full text and rfc822 format available.

Message #35 received at 70796 <at> debbugs.gnu.org (full text, mbox):

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 70796 <at> debbugs.gnu.org, yantar92 <at> posteo.net
Subject: Re: bug#70796: 30.0.50; bug-reference-mode leading to constant GCing
Date: Fri, 24 May 2024 22:19:11 +0200
Tassilo Horn <tsdh <at> gnu.org> writes:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> Hi all,
>
> I'm back and had a look at this issue.
>
>>> > Maybe bug-reference-fontify should return a list (jit-lock-bounds
>>> > beg end)?
>
> Indeed, that's what I'm doing now.  I'm not entirely sure if that fixes
> the GC issue but it's certainly a good idea anyhow.
>
> Please report back if it helps.

I'm afraid it didn't help yet. It's still GCing constantly, without
doing anything.

(I used your fix in a running Emacs, with the following change:

modified   lisp/progmodes/bug-reference.el
@@ -196,10 +196,10 @@ bug-reference-fontify
                              (funcall bug-reference-url-format)))))))
       ;; Delete remaining but unused overlays.
       (dolist (ov overlays)
-        (delete-overlay ov)))
-    ;; Signal the bounds we actually fontified to jit-lock to allow for
-    ;; optimizations (bug#70796).
-    `(jit-lock-bounds ,beg-line . ,end-line)))
+        (delete-overlay ov))
+      ;; Signal the bounds we actually fontified to jit-lock to allow for
+      ;; optimizations (bug#70796).
+      `(jit-lock-bounds ,beg-line . ,end-line))))
 
 ;; Taken from button.el.
 (defun bug-reference-push-button (&optional pos _use-mouse-action)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70796; Package emacs. (Fri, 24 May 2024 20:28:01 GMT) Full text and rfc822 format available.

Message #38 received at 70796 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 70796 <at> debbugs.gnu.org,
 Tassilo Horn <tsdh <at> gnu.org>
Subject: Re: bug#70796: 30.0.50; bug-reference-mode leading to constant GCing
Date: Fri, 24 May 2024 20:28:57 +0000
Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:

> I'm afraid it didn't help yet. It's still GCing constantly, without
> doing anything.

FYI, I have no problems on your file and I do have bug-reference-mode
enabled in all buffers.

Do you have a recipe starting from emacs -Q?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70796; Package emacs. (Fri, 24 May 2024 21:35:02 GMT) Full text and rfc822 format available.

Message #41 received at 70796 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 70796 <at> debbugs.gnu.org, yantar92 <at> posteo.net
Subject: Re: bug#70796: 30.0.50; bug-reference-mode leading to constant GCing
Date: Fri, 24 May 2024 23:34:24 +0200
Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:

>> Please report back if it helps.
>
> I'm afraid it didn't help yet. It's still GCing constantly, without
> doing anything.
>
> (I used your fix in a running Emacs, with the following change:

Oups.  Fixed on master.

But anyhow, I don't see how bug-reference-fontify could be so costly
GC-wise...

FWIW, I think goto-address-mode (buttonizing URLs and email addresses)
will probably have the same effect, at least the code looks pretty
similar.  Can you confirm?

I'll have a look at you sample file tomorrow.  How do you make GCs
"visible" so that I can see when excessive GCing starts/stops?

Bye,
  Tassilo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70796; Package emacs. (Sat, 25 May 2024 04:11:02 GMT) Full text and rfc822 format available.

Message #44 received at 70796 <at> debbugs.gnu.org (full text, mbox):

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 70796 <at> debbugs.gnu.org,
 Tassilo Horn <tsdh <at> gnu.org>
Subject: Re: bug#70796: 30.0.50; bug-reference-mode leading to constant GCing
Date: Sat, 25 May 2024 06:08:48 +0200
Ihor Radchenko <yantar92 <at> posteo.net> writes:

> Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:
>
>> I'm afraid it didn't help yet. It's still GCing constantly, without
>> doing anything.
>
> FYI, I have no problems on your file and I do have bug-reference-mode
> enabled in all buffers.
>
> Do you have a recipe starting from emacs -Q?

Not at the moment, sorry.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70796; Package emacs. (Sat, 25 May 2024 04:36:01 GMT) Full text and rfc822 format available.

Message #47 received at 70796 <at> debbugs.gnu.org (full text, mbox):

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 70796 <at> debbugs.gnu.org, yantar92 <at> posteo.net
Subject: Re: bug#70796: 30.0.50; bug-reference-mode leading to constant GCing
Date: Sat, 25 May 2024 06:34:03 +0200
[Message part 1 (text/plain, inline)]
Tassilo Horn <tsdh <at> gnu.org> writes:

> But anyhow, I don't see how bug-reference-fontify could be so costly
> GC-wise...

It is not by itself, AFAICT. Org fontification allocates which ich not a
problem normally, but with bug-reference active, it is triggered over
and over again.

Interesting observation:

I just built master without native compilation because that's faster.
With .elcs only, I don't seem to get the constant GCs with
9ebe6aa5f1092241a98e0a16db918e3dc1062f1c which is before your fix.
With native compilation I do.

Just double-checked that this is indeed the case. Now it gets
interesting :-/. This is on macOS 14.5, arm64, libgccjit 14.1.

> FWIW, I think goto-address-mode (buttonizing URLs and email addresses)
> will probably have the same effect, at least the code looks pretty
> similar.  Can you confirm?

Yes, goto-address-mode has the same effect.
>
> I'll have a look at you sample file tomorrow.  How do you make GCs
> "visible" so that I can see when excessive GCing starts/stops?

You can use the attached patch to log GC messages in *Messages* which
makes it easier to see. Then load the Org file, expand all nodes (S-TAB
as needed), move a bit around, and see it happening. And set
garbage-collection-messages to t of course.

[0001-On-no-branch-9ebe6aa5f10-lisp-dired.el-dired-mode-map-Bind-E-to-dired-do-open-bug-18132.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70796; Package emacs. (Sat, 25 May 2024 07:38:01 GMT) Full text and rfc822 format available.

Message #50 received at 70796 <at> debbugs.gnu.org (full text, mbox):

From: Tassilo Horn <tsdh <at> gnu.org>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 70796 <at> debbugs.gnu.org, yantar92 <at> posteo.net
Subject: Re: bug#70796: 30.0.50; bug-reference-mode leading to constant GCing
Date: Sat, 25 May 2024 09:37:18 +0200
Gerd Möllmann <gerd.moellmann <at> gmail.com> writes:

>> But anyhow, I don't see how bug-reference-fontify could be so costly
>> GC-wise...
>
> It is not by itself, AFAICT. Org fontification allocates which ich not
> a problem normally, but with bug-reference active, it is triggered
> over and over again.
>
> Interesting observation:
>
> I just built master without native compilation because that's faster.
> With .elcs only, I don't seem to get the constant GCs with
> 9ebe6aa5f1092241a98e0a16db918e3dc1062f1c which is before your fix.
> With native compilation I do.
>
> Just double-checked that this is indeed the case. Now it gets
> interesting :-/. This is on macOS 14.5, arm64, libgccjit 14.1.

I've now checked out the scratch/igc branch and opened admin/igc.org
with the current emacs (master branch) with native compilation + your
gc-messages patch and garbage-collection-messages set to t.  I cannot
reproduce the problem.

I've also added a (message "BRF") as first expression to
bug-reference-fontify.  After scrolling the buffer from top to bottom,
the function won't be called anymore unless I edit some text.  I assume
that in your case, bug-reference-fontify and font-lock-fontify-region
(the latter including the Org fontification) are run over and over again
unless you remove the former...

I have no explanation.  Especially with admin/igc.org,
bug-reference-fontify is essentially a no-op.  There are no bug
references (text matching bug-reference-bug-regexp), so it's just a
regex search with no match and there are no overlays created or moved.
How can a failed regex search somehow trigger another jit-lock cycle
(and only with native compilation on MacOS)?

>> FWIW, I think goto-address-mode (buttonizing URLs and email addresses)
>> will probably have the same effect, at least the code looks pretty
>> similar.  Can you confirm?
>
> Yes, goto-address-mode has the same effect.

Alright.  Then you can probably even simplify the issue with

--8<---------------cut here---------------start------------->8---
(defun i-do-nothing (start end) nil)
--8<---------------cut here---------------end--------------->8---

and then M-: (jit-lock-register #'i-do-nothing) RET in some buffer,
right?

Bye,
  Tassilo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70796; Package emacs. (Sat, 25 May 2024 08:00:02 GMT) Full text and rfc822 format available.

Message #53 received at 70796 <at> debbugs.gnu.org (full text, mbox):

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Tassilo Horn <tsdh <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 70796 <at> debbugs.gnu.org, yantar92 <at> posteo.net
Subject: Re: bug#70796: 30.0.50; bug-reference-mode leading to constant GCing
Date: Sat, 25 May 2024 09:58:15 +0200
Tassilo Horn <tsdh <at> gnu.org> writes:

>>> FWIW, I think goto-address-mode (buttonizing URLs and email addresses)
>>> will probably have the same effect, at least the code looks pretty
>>> similar.  Can you confirm?
>>
>> Yes, goto-address-mode has the same effect.
>
> Alright.  Then you can probably even simplify the issue with
>
> (defun i-do-nothing (start end) nil)
>
> and then M-: (jit-lock-register #'i-do-nothing) RET in some buffer,
> right?

Yes, same problem. In a native build with current HEAD,
984fb346fdf0d5ec9eaea6126aad0bea8823b8a3.

As I mentioned, no problem without native compilation. I guess you have
an x86 cpu? Just to make sure...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#70796; Package emacs. (Sat, 25 May 2024 08:18:02 GMT) Full text and rfc822 format available.

Message #56 received at 70796 <at> debbugs.gnu.org (full text, mbox):

From: "Tassilo Horn" <tsdh <at> gnu.org>
To: Gerd Möllmann <gerd.moellmann <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 70796 <at> debbugs.gnu.org,
 Ihor Radchenko <yantar92 <at> posteo.net>
Subject: Re: bug#70796: 30.0.50; bug-reference-mode leading to constant GCing
Date: Sat, 25 May 2024 10:17:03 +0200
Yes, right, x86 on GNU/Linux.

Am Sa, 25. Mai 2024, um 09:58, schrieb Gerd Möllmann:
> Tassilo Horn <tsdh <at> gnu.org> writes:
>
>>>> FWIW, I think goto-address-mode (buttonizing URLs and email addresses)
>>>> will probably have the same effect, at least the code looks pretty
>>>> similar.  Can you confirm?
>>>
>>> Yes, goto-address-mode has the same effect.
>>
>> Alright.  Then you can probably even simplify the issue with
>>
>> (defun i-do-nothing (start end) nil)
>>
>> and then M-: (jit-lock-register #'i-do-nothing) RET in some buffer,
>> right?
>
> Yes, same problem. In a native build with current HEAD,
> 984fb346fdf0d5ec9eaea6126aad0bea8823b8a3.
>
> As I mentioned, no problem without native compilation. I guess you have
> an x86 cpu? Just to make sure...




This bug report was last modified 6 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.