From 704ad13e3ee607be2d837b9bc250105d85b8c5bf Mon Sep 17 00:00:00 2001 From: Tharre Date: Mon, 27 Aug 2018 00:32:54 +0200 Subject: zsh: limit history in memory to 10000 lines 10000 lines should suffice in general, no need to waste additional memory. Additionally hist_expire_dups_first has been removed, because this causes a lot of additional CPU load, probably loading $HISTFILE over and over again. If further history is required, it can be loaded with a function like the following: function hist { local TEMPHISTFILE="$HISTFILE" local TEMPSIZE=$SAVEHIST fc -pa HISTSIZE=$TEMPSIZE fc -R "$TEMPHISTFILE" fc -l 0 } The problem with the above is that it will increase the memory footprint of the zsh process, up to ~50MiB, that doesn't seem to be freed later. Just grepping $HISTFILE produces a similar result, without this drawback. --- .zshrc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.zshrc b/.zshrc index 964c288..8c5c92e 100644 --- a/.zshrc +++ b/.zshrc @@ -31,13 +31,12 @@ zle -N bracketed-paste bracketed-paste-magic ## history HISTFILE="$ZSH_HOME/.zsh_history" -HISTSIZE=100000000 -SAVEHIST=$HISTSIZE +HISTSIZE=10000 +SAVEHIST=100000000 setopt extended_history setopt hist_ignore_dups setopt inc_append_history setopt share_history -setopt hist_expire_dups_first ## completion zmodload zsh/complist -- cgit v1.2.3-70-g09d2