14. Memory Issues

There are a number of approaches to saving memory on the 5MX. With 16 MB of memory (PRO users have the luxury of 32 MB), one must be careful not to start too many things running at once. Minimize, minimize, minimize, and conserve your memory!

One approach is to use tools that are designed to use less memory. Use ash as your default shell, though bash is generally far more useful. You might even be able to run xinit directly when you login, and so start up no initial shell at all - in /etc/passwd change your shell from /bin/sh to /usr/X11R6/bin/xinit...this might even work.... Use xvt or rxvt as your terminal, rather than xterm. Use a simpler, bare editor, such as nvi, rather than vim.

There are also ways of starting programs that save memory. For example, starting X using exec xinit , rather than startx or xinit saves the memory of a shell - startx is a shell script that stays running while X is running, and with exec X is started after exiting the shell and without restarting the getty on the terminal.

Don't start up applications, getty's, daemons, or shells that are not needed. Note that the installation of some packages such as at or cron will set up starting those daemons by default at boot time. These are not generally needed all the time, so you keep them from starting by deleting their startup scripts in the appropriate rcX.d directory. Or just stop them when you need more memory.

Another memory savings is to use kernel modules, rather than have all the drivers included in the kernel. This should save substantial memory. Load modules for such things as PPP, serial, IRDA, or sound only when they are needed. Kernel modules on the 5MX do work, although traditionally these have not been set up. The Sarge distribution contains all the utilities for handling kernel modules. The use of modules should save about 0.5 MB or more of memory; without modules the kernel size is about 1.4 MB.

My psion 5MX has the following memory usage for a minimal X session:

Table 3. TOTAL AVAILABLE MEMORY: 14500KB

PROCESSMEMORYSHARED
init252KB188KB
syslog288180
inetd232160
getty (ttyS1)192128
getty (ttyAM1)192128
sh492412
xinit652556
X2084988
WindowMaker21921505
keylaunch684596
rclock712628
xvt1196988
sh392316

The memory reported here is the value for RSS from top - much of this memory is shared among the other applications, particularly in X. This shared memory is an important feature of linux - starting N shells does not increase the usage of memory by a factor of N! What is the free memory available for other applications with X running? Probably around 6-8 MB.

Not all these processes are required. Of the processes listed here, syslog is probably optional, and the getty on ttyS1 is probably as well (it offers an escape from X). inetd and the getty on ttyAM1 might be started up only when one wanted to make a connection. All of which would save a little memory.

So, to be sure, one can't go beserk with the applications, while running Netscape, but many things will work fine.

As has been discussed, if you do run out of memory for a particular process, you can try to set up a swap space on your CF disk using a swap file or partition. However, this will be very slow. But it might just let you do what you want to do, with patience. This is a solution of last resort.