Subject: Re: bug#50061: 28.0.50; Hang caused by savehist-save when saving kill ring with large amount of data from nxml-mode buffer

From: Eli Zaretskii <[email-masked]>
Date: Sun, 15 Aug 2021 10:36:35 +0300

> From: Matt Beshara <[email-masked]>
> Date: Sun, 15 Aug 2021 12:46:09 +1000
> 
> >From emacs -Q:
>  1. M-x eww RET
>  2. mfa.pw/brave-new-world.xml RET
>  3. C-x h
>  4. M-w
>  5. C-x b *scratch* RET
>  6. (require 'savehist) C-j
>  7. (setq savehist-additional-variables '(kill-ring)) C-j
>  8. (savehist-save) C-j
>     At this point ‘savehist-save’ will work as intended, even with 
>     the
>     large amount of XML in the kill ring.
>  9. C-x b *eww* RET
> 10. M-x nxml-mode RET
> 11. C-x h
> 12. M-w
> 13. C-x b *scratch* RET
> 14. (savehist-save) C-j
>     Here is where Emacs hangs.  The Emacs process’s CPU usage goes 
>     to
>     100%, and it starts consuming greater and greater amounts of
>     memory.

nXML puts a lot of its private text properties on the text.  My guess
is that producing a printed representation for that consumes
inordinate amounts of memory.  For me, Emacs runs out of memory even
if I M-w only the initial chunk of the file that ends with "<p>Created
with abbyy2epub (v.1.7.6)</p></div>", and then do this in *scratch*:

  kill-ring C-x C-e