Re: 4 MB: no cloning starts / running 'lowmem'

From: Alfie Costa (agcosta@gis.net)
Date: Thu Oct 25 2001 - 04:57:26 CEST


On 24 Oct 2001, at 14:45, Michele Andreoli <mulinux@sunsite.dk> wrote:

> It {'lowmem'} is called by the father script: /linuxrc.

In the 9.x mu I'm looking at, /setup/rc/linuxrc, (of which /linuxrc is a link
to), does this:

1) Sets up the path.

2) Loads /etc/color and /etc/utils. /etc/color contains some color variables.
/etc/utils loads many functions. These variables and functions may devour what
'lowmem' needs.

3) Undermines Microsoft, (in color), for 2 seconds.

4) Runs this:

        ( mount /proc ) 2>/dev/null

Are the parenthesis '()' necessary? Parenthesis use a subshell. If they are
necessary, sometimes brackets '{}' will also work. Brackets do not use a
subshell.

5) Checks for low memory, and if true, runs 'lowmem'.

6) ...the code after that shouldn't matter -- except as it takes up space.

If it does matter, that space could be saved by splitting /setup/rc/linuxrc
into two scripts like so:

Old single /setup/rc/linuxrc script:

        1: #!/bin/ash
        2: ... lotsa code ...
        n: ....
        115: # End

New double /setup/rc/linuxrc scripts:

        1: #!/bin/ash
        2: ... less code ...
        n: ....
        30: [ "$MEM" -le "$MIN" ] && lowmem=yes
        31: exec /setup/rc/linuxrc_part_2

...and /setup/rc/linuxrc_part_2 would be lines 32-115 of the old
/setup/rc/linuxrc.

> I do not know how ash handle in-line functions like that, but surely in this
> form they consume further RAM. Some little kb?

I think so too. It seems odd that these small amounts of RAM would matter, yet
the proof is how the script hangs on low memory systems.

---------------------------------------------------------------------
To unsubscribe, e-mail: mulinux-unsubscribe@sunsite.dk
For additional commands, e-mail: mulinux-help@sunsite.dk



This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:20 CET