From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by melb.werple.net.au (8.7.5/8.7.3/2) with ESMTP id FAA23552 for ; Tue, 11 Jun 1996 05:24:46 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id PAA29167; Mon, 10 Jun 1996 15:13:17 -0400 (EDT) Resent-Date: Mon, 10 Jun 1996 15:13:17 -0400 (EDT) Sender: hniksic@public.srce.hr To: Zoltan Hidvegi Cc: (Hrvoje Niksic), zsh-workers@math.gatech.edu Subject: Re: HISTSIZE References: <199606101905.VAA07171@bolyai.cs.elte.hu> From: Hrvoje Niksic Date: 10 Jun 1996 21:10:30 +0200 In-Reply-To: Zoltan Hidvegi's message of Mon, 10 Jun 1996 21:05:20 +0200 (MET DST) Message-ID: X-Mailer: Gnus v5.2.14/XEmacs 19.13 Resent-Message-ID: <"cpuQ-1.0.f77.7F7ln"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/1316 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Zoltan Hidvegi (hzoli@cs.elte.hu) wrote: > > I wonder how difficult would it be to patch hist.c in such a way that > > the actual size of the history list changes dynamically, HISTSIZE > > being only an upper limit to that change. > > Zsh uses a HISTSIZE long array to store history entries. gethistent(X) is > defined as (histentarr+((X)%histentct)) (with proper bounds checking at > apropriate places). This is usually the most compact representation. A > linked list can be used but then the pointers would require extra memory. > histentarr is almost full in most cases since it is filled from $HISTFILE > upon invocation. Most people do like to limit the number of stored history > events since loading and saving big histories takes a long time. Of course > SAVEHIST can be smaller than HISTSIZE but most people do not issue more > than 1000 commands from one shell so HISTSIZE = SAVEHIST + 1000 should be > enough. Of course one must be able to limit the number of history items. But if you want to unlimit it (which I like to do) by setting it to 100,000 or to a 1,000,000, is where the problems arise. As far as I have seen, bash also represents the history list as an array, but it starts off with a default size and realloc's it dynamically each 50 or so commands. This way HISTSIZE is only a limit, not a memory consumer. So: gethistent(X) would still be equally defined, but the array would change its size dynamically. Is this doable? -- hniksic@srce.hr | Student of electrical engineering hniksic@fly.cc.fer.hr | University of Zagreb, Croatia ------------------------------------------------------------------ I'm a Lisp variable -- bind me!