On Thursday 09 February 2006 01:17, Duncan wrote:
> Simon Stelling posted <43EA568D.firstname.lastname@example.org>, excerpted below, on
> My thinking, which is possibly incorrect (your input appreciated), is that
> file-based scripts get pulled into cache the first time they are executed,
> and will remain there (with a gig of memory) pretty much until I'm done
> doing my upgrades. At the same time, they are simply in cache, not
> something in bash's memory, so if the memory is needed, it will be
> reclaimed. As well, after I'm done and on to other tasks, the cached
> commands will eventually be replaced by other data, if need be.
> Aliases (and bash-functions) are held in memory. That's not as flexible
> as cache in terms of being knocked out of memory if the memory is needed
> by other things. Sure, that memory may be flushed to disk-based swap, but
> that's disk based the same as the actual script files I'm using, so
> reading it back into main memory if it's faulted out will take something
> comparable to the time it'd take to read in the script file again anyway.
> That's little gain, with the additional overhead and therefore loss of
> having to manage the temp-copy in swapped memory, if it comes to that.
Besides the fact that memory use is negligeable, you should keep into account
that scripts (even oneliners) use one memory page per script. Aliasses
however are stored by bash in a way that multiple aliases fit into one block
of memory. And when the memory is needed, bash will be bumped out of memory
too. But the idea is that those small aliasses will not actually need more
Paul de Vrieze