Board index » delphi » problem with big programs in Pascal 6.0

problem with big programs in Pascal 6.0

Quote
> Hi .. can anyone help with this problem. I have asked my college
> tutotrs but as usual ..

> I am programming a large program in Pascal at the present, and having
> done 10000 lines, my program is now too large to fit in memory. I have
> used procedures and units to minimize my use of ram, but now I must
> use extra memory. How do I use RAM above my 640K base (over 600K of
> which is free)?

   In TP6.0, you can't.  You haven't stated which component (code, data,
constants) of your program makes it "too large", but I suspect it's the
total amount of code (otherwise, it wouldn't compile, would it?).  That
being the case, the conventional way to deal with the problem is to use
overlays - which is supported by TP6.0 and does a very nice job of
handling this situation.  Building overlays is pretty simple (once you've
read the documentation and applied that information), but the difficult
part is deciding how to segment/package your application to make
effective use of overlaying (swapping functional segments of the code in
and out as they're needed), and to not cause "thrashing", the excessive
swapping of needed logic in and out because some routines are needed by
many routines.  This latter effort is sometimes done through trial and
error, but it really requires intimate knowledge of how the application
operates: what functions are discrete and separate, versus those which
are intimately using by everything.
   If you want more help (and have time to work this out), just call...
 

Re:problem with big programs in Pascal 6.0


Quote
Ian Robinson wrote:

> Hi .. can anyone help with this problem. I have asked my college
> tutotrs but as usual ..

> I am programming a large program in Pascal at the present, and having
> done 10000 lines, my program is now too large to fit in memory. I have
> used procedures and units to minimize my use of ram, but now I must
> use extra memory. How do I use RAM above my 640K base (over 600K of
> which is free)?

There are several ways to get around this:
1) Overlays may help.  I don't have much experience with them, however:
I've
   never had to use 'em.
2) Use XMS/EMS.  I think I have some unit sources here somewhere...
Ooh!  Ooh!
   I just found a XMS unit.  I haven't tried it, however.  I can email
it to
   you if you want it.  Now to think if it, I have several XMS units!
3) Use Protected Mode.  Will make XMS/EMS use transparent. (assuming, of
course,
   you have a protected mode compiler)
4) A good bet would be to use one of the 32-bit Pascal compilers:

FPK-Pascal:http://sun01.brain.uni-freiburg.de/%7Eklaus/pascal/fpk-pas/
   TMT-Pascal:http://www.tmt.com/download.htm
   GNU Pascal:http://agnes.dida.physik.uni-essen.de/~gnu-pascal/
   They're all Borland Compatible; FPK-Pascal has the greatest
compatibility,
   however.  Please note that TMT-Pascal is shareware.  GNU Pascal is
freeware;
   I believe that FPK-Pascal is also freeware.

--
----------------------------------------------------------------------
Phil Brutsche

"Be of stout heart, Number One.  We've handled the Borg.  We can
certainly handle Admiral Jellico." - Jean-Luc Picard

----------------------------------------------------------------------

Re:problem with big programs in Pascal 6.0


Hi .. can anyone help with this problem. I have asked my college
tutotrs but as usual ..

I am programming a large program in Pascal at the present, and having
done 10000 lines, my program is now too large to fit in memory. I have
used procedures and units to minimize my use of ram, but now I must
use extra memory. How do I use RAM above my 640K base (over 600K of
which is free)?

Thanks

Simon Creasy

c/o

Re:problem with big programs in Pascal 6.0


 Hi .. can anyone help with this problem. I have asked my college

Quote
> tutotrs but as usual ..

> I am programming a large program in Pascal at the present, and having
> done 10000 lines, my program is now too large to fit in memory. I have
> used procedures and units to minimize my use of ram, but now I must
> use extra memory. How do I use RAM above my 640K base (over 600K of
> which is free)?

> Thanks

> Simon Creasy

        Pointers
--
Hilton Evans
***********************************************************
The two most important things in life are personal
health and time ... H.Evans 1995
**********************************************************
Chempen+ Chemical Structure Drawing
Software for Windows
http://www.ici.net/cust_pages/hfevans/chempen.htm

Ian Robinson <i...@corp.u-net.com> wrote in article
<34c64ad7.424...@news.u-net.com>...

Quote

Re:problem with big programs in Pascal 6.0


Quote
Ian Robinson wrote:
> Hi .. can anyone help with this problem. I have asked my college
> tutotrs but as usual ..

> I am programming a large program in Pascal at the present, and having
> done 10000 lines, my program is now too large to fit in memory. I have
> used procedures and units to minimize my use of ram, but now I must
> use extra memory. How do I use RAM above my 640K base (over 600K of
> which is free)?

In a regular real mode program, memory will remain under the 640K mark.  Off
the top of my head, I'm not sure a TP program will use upper memory (the other
384KB below 1MB, most of which is usually mapped to peripheral cards and the
system BIOS), but I suspect not.  and memory above 1MB can't be used in a real
mode program for code at all since it can't be referenced with a 20-bit
address.

If there's a lot of data, you could look into EMS or XMS, but that just adds
more code to the already trememndous amount.  The reasonable solution would be
to look into overlaying your units.  This way, not all the program is loaded
into memory, just critical parts.  Then you can use either the disk or EMS for
providing an overlay buffer.

See the Language Guide for information about using overlays.

Quote
> Thanks

> Simon Creasy

> c/o

--
Scott Earnest            | SPAM protection in effect. Remove  |
setech@_ix.netcom.com    | "_" as needed for true addresses.  |
earnests@_homenet.lm.com |    UIN:1136443  EFnet:pale_blue    |
sinykal@_{*word*104}space.org  | URL: http://www.netcom.com/~setech |

Re:problem with big programs in Pascal 6.0


You can also use DPMI (Protected Mode in BP 7.0) - just turn your real mode
to protected mode destination.

Re:problem with big programs in Pascal 6.0


Re:problem with big programs in Pascal 6.0


0. You have to tell us more about the nature of your problem,
otherwise help is very difficult.

1. Does your prg compile in IDE without error?
Yes: -> 2.
 No: -> 3.

2. Runtime-Error HEAP OVERFLOW?
Yes: -> 7. & 10.
 No: -> Fine, done!

3. Does your prg compile with TPC (commandline compiler) without error?
Yes: -> Fine, done!
 No: -> 4.

4. Advice: eleminate all TSR and use HIMEM.SYS+EMM396.EXE+LOADHIGH
   Does your prg compile with IDE/TPC now without error?
Yes: -> Fine, done!
 No: -> 5.

5. CODE segment to large?
Yes: -> 6. & 7. & 10.
 No: -> 8.

6. Advice: Try to use OVERLAYS or
7. Advice: Try to use the protected mode FPK-Pascal-Compiler, Done.

8. DATA segment to large? (DATA segment is limited to 64 kB!)
Yes: -> 9. & 7. & 10.
 No: -> Need more Info -> 0.

9. Advice: Use dynamic data instead of static data.
   Old: A: Array[1..20000] Of Word; (uses 40000 byte of DATA segment)
   New:
     Atyp: Array[1..20000] Of Word;
     A: ^Atyp;  { pointer to Atyp } (uses 4 byte of DATA segment)
     Begin
       New(A);
       A^[1] := 0;
     End;
   Does your prg compile with IDE/TPC now without error?
Yes: -> Fine, Done.
 No: -> 10.

10. Advice: I strongly suggest to rethink your datastructures and your
algorithms! -> 0.

mailto:Antivivisekt...@t-online.de

Other Threads