zsh-workers
 help / color / mirror / code / Atom feed
* HISTSIZE
@ 1996-06-08 20:17 Hrvoje Niksic
  1996-06-10 19:05 ` HISTSIZE Zoltan Hidvegi
  0 siblings, 1 reply; 3+ messages in thread
From: Hrvoje Niksic @ 1996-06-08 20:17 UTC (permalink / raw)
  To: ZSH Workers Mailing List

I have noticed that when I set HISTSIZE (the maximum size of the
history list) in zsh to something huge, zsh takes huge amounts of
memory.

When I converted from bash, I have easily ported all the init files,
and HISTSIZE caused terrible problems (especially since I didn't know
HISTSIZE was causing them). The reason I set HISTSIZE to such a big
value is just to keep it from bothering me -- it is just a *maximum*
value I am changing. In bash it worked exactly that way (no additional
memory expense). But it seems that the organization of history storage
requires resizehistevents() to reallocate the list to HISTSIZE history
entries.

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.

-- 
hniksic@srce.hr              |  Student of electrical engineering
hniksic@fly.cc.fer.hr        |  University of Zagreb, Croatia
------------------------------------------------------------------
"Learning XEmacs is a lifelong activity. I've been using Emacs for over
a decade now, and I'm still discovering new features." -- from XEmacs FAQ



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: HISTSIZE
  1996-06-08 20:17 HISTSIZE Hrvoje Niksic
@ 1996-06-10 19:05 ` Zoltan Hidvegi
  1996-06-10 19:10   ` HISTSIZE Hrvoje Niksic
  0 siblings, 1 reply; 3+ messages in thread
From: Zoltan Hidvegi @ 1996-06-10 19:05 UTC (permalink / raw)
  To: Hrvoje Niksic; +Cc: zsh-workers

> I have noticed that when I set HISTSIZE (the maximum size of the
> history list) in zsh to something huge, zsh takes huge amounts of
> memory.
> 
> When I converted from bash, I have easily ported all the init files,
> and HISTSIZE caused terrible problems (especially since I didn't know
> HISTSIZE was causing them). The reason I set HISTSIZE to such a big
> value is just to keep it from bothering me -- it is just a *maximum*
> value I am changing. In bash it worked exactly that way (no additional
> memory expense). But it seems that the organization of history storage
> requires resizehistevents() to reallocate the list to HISTSIZE history
> entries.
> 
> 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.

Zoltan



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: HISTSIZE
  1996-06-10 19:05 ` HISTSIZE Zoltan Hidvegi
@ 1996-06-10 19:10   ` Hrvoje Niksic
  0 siblings, 0 replies; 3+ messages in thread
From: Hrvoje Niksic @ 1996-06-10 19:10 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: , zsh-workers

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!



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1996-06-10 19:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-06-08 20:17 HISTSIZE Hrvoje Niksic
1996-06-10 19:05 ` HISTSIZE Zoltan Hidvegi
1996-06-10 19:10   ` HISTSIZE Hrvoje Niksic

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).