Subject: bug#70796: 30.0.50; bug-reference-mode leading to constant GCing

From: Eli Zaretskii <[email-masked]>
Date: Mon, 06 May 2024 14:48:29 +0300

> From: Gerd Möllmann <[email-masked]>
> 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.