[Top][All Lists]

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

bug#30943: save-hist creates massive cache file

From: Eli Zaretskii
Subject: bug#30943: save-hist creates massive cache file
Date: Mon, 26 Mar 2018 17:59:43 +0300

> From: Chris Findeisen <address@hidden>
> Date: Sun, 25 Mar 2018 19:11:21 +0000
> save-hist-additional-variables never get truncated by save-hist, leading
> to a massive cache file and slowdown. Practically, this matters when the 
> cache file silently grows to 1/2 a
> GB, and emacs begins randomly freezing.
> history-length is supposed to keep a limit on the max history for 
> save-hist-additional-variables, but it doesn't.
> In the savehist-save function:
> (dolist (symbol savehist-minibuffer-history-variables)
>           (when (and (boundp symbol)
>                      (not (memq symbol savehist-ignored-variables)))
>             (let ((value (savehist-trim-history (symbol-value symbol)))
>       ;;....
>   ))))
> (dolist (symbol savehist-additional-variables)
>   (when (boundp symbol)
>     (let ((value (symbol-value symbol)))
>     (when (savehist-printable value)
>     ;; ...
>     ))))
> As you can see, the save-hist-trim-history fn is not called in the
> second code block.

I'm not sure I understand the situation.  Is the variable you are
trying to save using save-hist a long list or something, and it keeps
growing from session to session without any limitation?

Save-hist doesn't truncate any variables except the ones it knows
about, because it cannot be sure that truncating some list might leave
the variable with an invalid value.  For variables like
minibuffer-history, it knows that truncating the history will produce
a history that is still valid, but how can it do the same with other
variables?  For example, it could be that some other variable needs to
be truncated from the other end of the list, otherwise the value will
be useless.

If I'm missing something about your use case, please tell the details,
and perhaps show an example of a variable with which this happens.


reply via email to

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