VOICE Home Page: http://www.os2voice.org |
[Previous Page] [Next Page] [Features Index] |
By Christian Hennecke ©August 2000 The OS/2 Files: http://www.os2world.com/os2files/ |
So here we go again. This month we will take a look at memory consumption and
how to reclaim some of the memory OS/2 itself and your applications use. Of course
the cost of RAM cards has dwindled significantly during the last years, but nevertheless
RAM still is not free. Applications have also rapidly grown in size, thus increasing
the need for large amounts of RAM and compensating for the lower cost. And there
are still people out there who have to work using memory constrained machines.
Last month I mentioned that the installation instructions for emTeX contain the
IOPL=YES statement. According to a message I received from Andre Sonnet
this is only necessary if you want to use dviscr or if dvipm is
configured to change the VGA- or 8514/A-palette for better greyscale display. Well,
on today's machines this is obsolete. One less reason to keep IOPL=YES.
Thanks, Andre!
This article is part of a series on improving your OS/2 system that is published
in the VOICE Newsletter. Last month's articles covered CD-ROM and hard drive performance,
responsiveness and stability issues. All the tips can be viewed at my homepage at
http://www.os2world.com/os2files/
by selecting the tuning link.
Again: These tips apply for the most part to all versions of Warp, unless otherwise
noted. They also take into account that you might be running an old, slow machine.
There may be errors or omissions that might lead to your machine blowing up. I strongly
advise you to make a backup before fiddling around with your system's settings.
You've been warned.
For credits please see "How to Supercharge OS/2 Warp - Part 1" in the
June 2000 issue of the VOICE Newsletter.
Getting OS/2 to really fly is mostly about memory, and how you use it. The more
memory OS/2 has, the happier it is. That is the Cardinal Rule. Nowadays I'd recommend
using a minimum of 64MB if you want to run big programs like StarOffice 5.1a or
Netscape Communicator 4.61 or Java applications and still be able to do some decent
multitasking. CPU power is not that important. Things like DeScribe or Papyrus
will fly on a 486DX4/100 with 64MB RAM and you will most probably still be able
to burn your CDs in the background.
First off, you must realize that just because you are not running a program,
that does not mean that it is not consuming memory. Many programs, upon installation,
will register program classes and templates with the Workplace Shell. This will
increase OS/2 memory consumption across the board. Some examples are the Internet
Access Kit, the IBM Works programs and StarOffice. Therefore, only install programs
that you are going to use. Also, most programs will add some statements to your
CONFIG.SYS file, when they are installed. These statements might be in
the form of SET xxx=yyy, or might load some type of program driver or start
a background process. This driver will sit in memory, occupying valuable resources
that OS/2 could put to better use and a background process will additionally need
some processing time. Again, if you don't need it, don't install it.
If you must install a software that you only use occasionally, e.g. the networking
stuff or Win-OS/2, you can setup several different CONFIG.SYS files. Here
is how to go about it in just a few steps:
I have used this feature for quite a while now to start Warp in various modes.
Sometimes I just want OS/2 without any DOS/Win support slowing me down. Other times
I want to boot up without the overhead of the LAN Requester stuff. You get the idea.
Probably the most pertinent use of this feature at this point would be to benchmark
the results of all the changes that you will make to your CONFIG.SYS file,
compared to your original one.
WARNING: Turn off the "Display recovery choices at each boot" option
before you apply a fixpak! Not doing so may prevent the fixpak install from completing
successfully.
Upon system startup OS/2 loads a lot of DLLs it finds into memory. The advantage
of this behaviour is that they are always ready to use when needed. On the other
hand many of these DLLs will only be needed occasionally every other day and take
up valuable memory the rest of the time. It is possible to regain quite some memory
by using the tool Allocmem.
It forces OS/2 to swap out nearly all DLLs, i.e. the data is transferred to the
swapfile. The physical memory claimed by the DLLs prior to the transfer is freed.
The only drawback is that now even standard DLLs have to be reloaded into memory
again resulting in a one-time performance impact.
Note: Be sure to adapt your swapfile's initial size to reflect the new size after
Allocmem has been run, so OS/2 doesn't have to enlarge the file in the future.
To get an impression of the possible gain have a look at the following. My system
has about 72MB of free physical memory on startup with 128MB being installed. Running
Allocmem increases the free RAM to 95MB. After the reload process the system usually
ends up with about 90MB of free RAM. So there are 18 megabytes of additionally
available physical memory. The swapfile first grows to approx. 45MB and then it
gets shrunk to 33MB.
You can also use Allocmem to regain memory that gets lost due to memory leaks.
When a program doesn't correctly free used memory again, this memory will be unavailable
afterwards as it is still marked as allocated. Now if you run Allocmem the memory
will be written to the swapfile. This way you will lose part of your swap space
until the next reboot, but the amount of physical memory is available again.
VoiceType is a giant CPU power and memory hog even if you turn it off by saying
"Go-to-sleep" or turning off the microphone. So if you don't use it prevent
OS/2 from loading it at all on startup by commenting out the statements beginning
with SET SPCH_ and removing directories beginning similar to x:\VT\SPCH_
from PATH, LIBPATH and DPATH.
However, a properly trained VoiceType fed by a good soundcard is a great help when
entering text. This is the perfect example why you may want different CONFIG.SYS
files to choose from. The best way is to copy your standard CONFIG.SYS
to, say, \OS2\BOOT\CONFIG.V on your boot drive and then remove the VoiceType-related
statements from the original CONFIG.SYS. That way you will normally start
your system without VoiceType and be able to activate it if you need it by
pressing ALT-F1 at boot time (if you don't have the Display recovery choices
at each restart option enabled) and then pressing the V key.
An OS/2 feature that consumes several hundred K of memory are the system sounds.
If you can live without all the noise, then find the Sound icon in the Multimedia
folder on your Desktop. De-select the sound options. To save even more memory, do
the following: open an OS/2 window, change to the \MMOS2\INSTALL directory,
type DINSTSND. Now shut down and reboot. This will de-register system sounds
from the Workplace Shell and return a few precious K to the operating systems memory
pool. Not to fear; all of the above is not permanent. If you want the noise back,
do the following: open an OS/2 window, change to the \MMOS2\INSTALL directory,
type INSTSND. Shut down and reboot. Open the Sound icon in your Multimedia
folder and select the sound options. That's all there is to it.
There are many easy things that you can do to speed up your computer and regain
some memory. For example, click on the System Setup icon in the OS/2 System folder.
Now double-click on the System icon. Go to the tab that says Input, and disable
type-ahead. This disables a buffer OS/2 uses to keep key strokes you enter in the
period between the command to start a program and the point where it is ready to
process. Now go to the Printscreen tab and disable that too. You will loose the
hardcopy feature, but then there is software like PMView that does a much better
job. Go to the Logo tab and click on none. There; you have just saved yourself dozens
of precious K of memory and sped up your computer in the bargain.
If you are a bit more adventurous about saving memory, you might want to reduce
the threads parameter in your CONFIG.SYS file. This parameter
controls the maximum number of threads that the operating system will create to
run programs. Remember that many OS/2 programs will ask for more than one thread
to run, so even though you are only running three programs, they might be consuming
fifteen or twenty threads. You don't want to set this number too low or you will
run into problems once your programs request more threads than you have made available.
As a rule of thumb most home users won't ever need more than 256 threads. If you're
planning to use networking stuff, i.e. the LAN Requester and Peer Networking, or
XFree86/OS2 you should enlarge the number to 384 or 512.
Usually you would want to allocate roughly 50% more threads than your maximum
(just in case). How do you find out how many threads you are actually using at the
moment? The easiest way is to use a tool like Memsize by Rick Papo that will directly
display the current count of threads used. Otherwise go to an OS/2 command prompt
and type PSTAT /C >FILE1. This will create a file called
FILE1, which you can then view by typing E FILE1.
This file will list all running processes and threads at the moment that you started
the pstat command. Therefore, it would be a good idea to be running all the software
you regularly run, and then run pstat in order to get a more precise number. In
the text file that pstat created you will find a column called Thread ID. This is
a column that lists all the thread numbers for each process. Go through the text
file and add up all these numbers, and that will tell you how many threads you are
using.
Now you can add 50% to that, and change the THREADS=
line in your CONFIG.SYS accordingly, and then reboot. Each
thread consumes 512 bytes of memory. Depending how much you are able to lower this
number will determine how much memory you save.
Commenting out some unused drivers in your CONFIG.SYS
file will also speed up your boot times and reduce memory overhead. By commenting
out a line, I mean placing a REM<trailing space> at
the start of a line. This is usually safer than deleting the line, because at some
time in the future you might need it back.
Some easy ones to start with are
For all you Warp Connect users, in your CONFIG.SYS
file is a driver called DETNE2.SYS. What it does is look
for clones of the NE2000 network adapter card that are non-standard, and attempt
to compensate for some non-standard functions. If your network card is other than
a clone NE2000, then you can REM the line BASEDEV=DETNE2.SYS
and save roughly 16K.
Turning off the undelete utility is also a good idea. Doing so will save some
precious memory and a lot of program overhead. Moving, copying, and deleting files
will appear much faster with undelete turned off. To turn it off, edit your CONFIG.SYS
file. Find the line that says SET DELDIR=C:\DELETE,512; and
delete it or comment it out. Now shut down and reboot. If you accidently deleted
a file and want it back you can use tools like DFSee or FilePhoenix. There are also
some Mac-like trashcans available.
If you don't use a lot of Windows programs, then turning off the Fast Load
feature will save memory and boot-up time. Do a right-click on the Desktop, and
select System Setup. From that folder, select WIN-OS/2 Setup. Double-click on that
icon, and select the 3.1 Session tab of the notebook. Make sure that the WIN-OS/2
Window section has the Fast Load option un-checked.
In case you are only running OS/2 software and don't need the DOS/Windows
compatibility, then you can turn them off and recover the 640K that DOS normally
lives in and the space all the necessary driver occupy. Edit your CONFIG.SYS
file and find the line that says PROTECTONLY=NO. Change it
to read PROTECTONLY=YES. Now comment out or delete any line
that begins with x:\OS2\MDOS\V..., the one that loads DOS.SYS
and lines like the following: SHELL=C:\OS2\MDOS\COMMAND.COM C:\OS2\MDOS
FCBS=16,8
RMSIZE=640
DOS=LOW,NOUMB
RUN=C:\MPTN\BIN\VDOSCTL.EXE
DEVICE=C:\TCPIP\bin\vdostcp.sys
DEVICE=C:\MPTN\BIN\VDOSTCP.VDD
You can save lots of memory by restricting the number of installed fonts to
the absolutely necessary. This will also decrease boot time and applications that
are using fonts will load faster. Each font you install takes a minimum of 2K, even
if it is not used. If it is used the number will increase. The specific RAM usage
varies depending on the font itself and its font family. Outline fonts will take
less RAM than bitmapped fonts since each bitmapped character is loaded into memory.
In case you really have to use a large number of fonts consider using a tool like
the discontinued FontFolder that lets you specify certain font libraries to load.
This way you will have the fonts needed for a specific task while minimizing memory
strain.
OS/2 Warp 4 comes with the WarpGuide. This program runs in the background
and can automatically assist you in certain tasks. While this is a Good Thing(tm)
for people unfamiliar with OS/2 it can get annoying to the more experienced user.
Not enough it sits in the background monitoring your activities waiting for you
to do something it can help you with. This way valuable CPU power and RAM are wasted.
So if you don't need WarpGuide turn it off. Open the WarpGuide folder's (it's in
the Information center) properties and go to the Appearance tab. Deselect Assist
me with selected tasks.
Another month's article has come to an end. Feel free to ask if anything is
confusing or you want to know more. Next month we will have a look at video and
GUI performance.