51: I am running out of
memory when compiling my large program. What
can I do?
A:
If you are compiling your program from within the
IDE (the
Integrated Development Environment) then select the Option from
the
main menu, choose the Compiler item and set the Link buffer to
Disk. (Also make the Compile option Destination to be Disk).
If this is not sufficient, next resort to using the TPC
command
line version of the Turbo Pascal compiler instead of the IDE.
Use
the "Link buffer on disk" option.
Divide your program into units. It is advisable
anyway for
modularity when your program size grows.
If you have extended memory, instead of
TURBO.EXE use TPX.EXE, if
you have TP 7.0. If you are into protected mode programming then
use
Borland Pascal BP 7.0.
A2: If you would prefer compiling your program from
within the IDE
but cannot do it for the above reason (or if you would prefer to
compile your program from within your favorite editor instead of the
TP IDE) you can use the following trick. If your editor has a macro
language like most good editors do, the assign a hotkey macro
that
compiles the current file with the TPC. If you are using SemWare's
QEdit editor you'll find such a macro in ("Macros and
configurations
for QEdit text-editor") ftp://garbo.uwasa.fi/pc/ts/tsqed17.zip.
Also your editor must be swapped to disk during
the compilation
if memory is critical. There is a very good program for doing that:
ftp://garbo.uwasa.fi/pc/sysutil/shrom24b.zip ("Shell Room,
Swap to
disk when shelling to application"). For example I invoke the
QEdit
editor with using the following batch:
c:\tools\shroom -s r:\cmand -z 1024 c:\qedit\q %1 %2 %3 %
4 %5 %6 %7
You'll find more about the switches in the Shell Room
documentation.
The -s switch designates the swap destination (my r:\cmand
directory
is on my ramdisk). The -z switch sets the shell environment size.
An unfortunate part is that the TP 5.0 Turbo Pascal IDE is
about
the only program I know that is not amenable the to Shell Room
utility, so you cannot utilize Shell Room to swap the TP IDE to
disk. Blessfully, at least TP 7.0 no more has this problem.