                                MEMORY.TXT

The purpose of this text is to describe the amount of memory needed to make
use of the bitmap procedures and functions contained in the example programs.
It also tells how to get the most out of your memory in Windows (3.1 or 3.11).

To approximate the size of a given BMP file before it is rendered:

For 8 bit palette mode:
Bytes = X dimension * Y dimension + 1K

For 24 bit true color mode:
Bytes = X dimension * Y dimension * 3

Example: a standard VGA size picture is 640 by 480 pixels.

In the palette mode this means:
640 * 480 + 1,024 = 308,200 bytes.
This number divided by 1,048,576 (1 Meg) is about 0.29, approximately. 1/3 of a Meg.

In the true color mode this means:
640 * 480 * 3 = 921,600 bytes or about 88% of 1 Meg.

Calculating the exact number of bytes requires greater knowledge of the
bitmap format because in many cases space holding bytes are stored that
do not contain any important information at all. These extra bytes are
placed so that the computer can read the file in 32 bit blocks for better
speed. So, keep in mind that in some cases the file will be larger than
what these formulas would indicate.

Specific information in the following paragraphs only applies to Windows 3.1 or 3.11.

DOS and Windows both take up the better part of the first 4 Meg of your
system. This is if you have 4 Meg or more of RAM and you are running Windows
in the "Enhanced Mode". If you have less than 4 Meg in your box, you're 
pretty much done right here.

Only pictures larger than the amount of free memory left after loading DOS,
Windows, and whatever other programs you're running, are going to need
virtual memory. If you run one of my example programs, and you hear that
familiar grinding noise of your hard drive, well... you're using virtual
memory.

Virtual memory, if you don't already know, is a way your computer can use
space on your hard drive as though it was RAM. Your microprocessor can only
directly manipulate information in the RAM you paid good money for, so, as it
turns out, the less physical RAM you have, the less virtual memory Windows can
handle. Lots of RAM and a big, fast hard drive will allow Windows to use HUGE
amounts of virtual memory. Your machine might be able to make use of 70 Meg or
even more. The only cost to you is time. Your hard drive can probably store
70 Meg with ease; but not at RAM speed. Herein lies a threshold. If the size of a
program generating a bitmap requires even one more byte than your computer's
physical RAM can contain, Windows will resort to using the swap file and the speed
of your application will dive-bomb. Once you get past this, the next limit happens
when you approach the end of all of your memory, virtual or otherwise. So much
swapping is necessary, your computer spends more time keeping track of memory than
it does your application, and things can get really slowed down.
 
Go into Windows "Main". Open "Control Panel". Open "386 Enhanced".
Select "Virtual Memory...". This will display the current setting
of your Windows virtual memory. If necessary, select "Change>>".
If it will allow you, select "Permanent" as the "Type" and enter some 
number up to, but not exceeding, the "Recommended Size:" in the "New Size:"
box. Do not exceed the "Recommended Size:" amount. It won't do you any good.
If you can, "X" the box marked "Use 32-Bit Disk Access" (Windows 3.11).
If you know you have a good sized hard drive, but Windows won't let you use
very much of it (less than 10 or 15 Meg) then your drive is probably full.
Keep in mind, as long as Windows is using a permanent swap file, that amount of
disk space can no longer be used by anything else. That includes DOS applications,
even when Windows isn't running. Even when you have created a permanent swap
file, Windows still uses temporary files to store stuff. Check your
AUTOEXEC.BAT file for a line that might read "TEMP=C:\[something]".
If you've ever crashed out of Windows, that is, locked up and had to reset,
there will be junk files left over that have no use at all - only to fill
up space on your drive. Look into the directory indicated as "TEMP=..."
in AUTOEXEC.BAT. There you will find files that start with a "~",
and have some nonsense letters and numbers followed by the extension
".TMP". Delete all of them (del ~*.tmp). If these files were found in a
directory that contains other important stuff, like "C:\DOS" or "C:\WINDOWS",
create a sub-directory within the Windows directory called "TEMP" and change
the line in your AUTOEXEC.BAT file to read "TEMP=C:\WINDOWS\TEMP". 
Now all of Windows' junk files will be easy to find and delete after 
any time you crash out.

Having done all this, the maximum size of image you can create is the
sum of your physical and virtual memory minus a bit less than 4 Meg, or so.  
