From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#30943: save-hist creates massive cache file Date: Mon, 26 Mar 2018 17:59:43 +0300 Message-ID: <83o9jag9wg.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1522076304 17872 195.159.176.226 (26 Mar 2018 14:58:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 26 Mar 2018 14:58:24 +0000 (UTC) Cc: 30943@debbugs.gnu.org To: Chris Findeisen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Mar 26 16:58:20 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f0TZj-0004Wj-4T for geb-bug-gnu-emacs@m.gmane.org; Mon, 26 Mar 2018 16:58:19 +0200 Original-Received: from localhost ([::1]:57211 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0Tbm-0006sr-GF for geb-bug-gnu-emacs@m.gmane.org; Mon, 26 Mar 2018 11:00:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0TbY-0006np-Ad for bug-gnu-emacs@gnu.org; Mon, 26 Mar 2018 11:00:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0TbO-00052H-VB for bug-gnu-emacs@gnu.org; Mon, 26 Mar 2018 11:00:12 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:46595) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0TbO-000528-S3 for bug-gnu-emacs@gnu.org; Mon, 26 Mar 2018 11:00:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1f0TbO-0000Z7-E0 for bug-gnu-emacs@gnu.org; Mon, 26 Mar 2018 11:00:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 26 Mar 2018 15:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30943 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 30943-submit@debbugs.gnu.org id=B30943.15220763872119 (code B ref 30943); Mon, 26 Mar 2018 15:00:02 +0000 Original-Received: (at 30943) by debbugs.gnu.org; 26 Mar 2018 14:59:47 +0000 Original-Received: from localhost ([127.0.0.1]:54492 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f0Tb8-0000Y6-Vc for submit@debbugs.gnu.org; Mon, 26 Mar 2018 10:59:47 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60754) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f0Tb7-0000Xs-9X for 30943@debbugs.gnu.org; Mon, 26 Mar 2018 10:59:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0Taw-0004ZD-DX for 30943@debbugs.gnu.org; Mon, 26 Mar 2018 10:59:40 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:44965) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0Taw-0004Z1-Ah; Mon, 26 Mar 2018 10:59:34 -0400 Original-Received: from [176.228.60.248] (port=2856 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1f0Tav-0005Us-Ma; Mon, 26 Mar 2018 10:59:34 -0400 In-reply-to: (message from Chris Findeisen on Sun, 25 Mar 2018 19:11:21 +0000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:144631 Archived-At: > From: Chris Findeisen > 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. Thanks.