Board index » delphi » DOS and Borland Pascal memory size

DOS and Borland Pascal memory size

I have a simple application which will be run on old hardware in the middle
of athletic tracks and therefore I am using DOS and Borland Pascal V7.0.

I am having troubles with memory and need assistance in understanding how
much memory I can utilise in the program.

The hardware is a 486 @ 100MH with 16MB of memory.

With BP targeted towards PROTECTED mode the largest HEAP size I can
get (MemAvail command) is around 1MB. I require more than this for a couple
of large arrays.

DOS HIMEM.SYS loaded.
All the Borland DPMI and RTM is in the correct Place.
A DOS MEM /C command shows 13MB of free extended memory.

Can anyone help with information on how memory is allocated between DOS, the
Borland runtime environment, etc.

Thanks Ian Upton

 

Re:DOS and Borland Pascal memory size


{whispering so as not to attract the attention of the 'wrong newsgroup
posting monitors')

free pascal (fpc ) allowz much larger arrays than does bpc/tpc 7.0 and
it will run on the system you have - I have some very large code running
on 486's.

Delphi 2.0 (dcc32) (Borland Pascal 9.0) can handle [1..10000],[1..10000]
fpc gives a 'Load error: no DPMI memory' error at [1..4000],[1..4000]

with fpc [1..3000],[1..3000] it appears to be using the disk drive for
virtual memory usage??

fpc runs [1..2000],[1..2000] (optimized) in 4.62 seconds on a P166 Cyrix
dcc32 runs [1..2000],[1..2000] in 14.92 seconds on a P166 Cyrix

program arraymem;

var i  : integer;
    j  : integer;
    n  : integer;

 mt : array[1..2000, 1..2000] of string;

{ mt : array[1..3000, 1..3000] of string; }  { runs on disk/virtual ?? }

{ mt : array[1..4000, 1..4000] of string; } { fpc : Load error: no DPMI
memory }

{ mt  : array[1..10000, 1..10000] of string; } { delphi }

begin

writeln;
write('writing to array');

n := 2000;
for i := 1 to n do
  for j := 1 to n do mt[i,j] := '0';
writeln;

writeln('mt[',(n-1),',',(n-1),'] : ', mt[(n-1),(n-1)]);

end.

Quote
Ian Upton wrote:

> I have a simple application which will be run on old hardware in the middle
> of athletic tracks and therefore I am using DOS and Borland Pascal V7.0.

> I am having troubles with memory and need assistance in understanding how
> much memory I can utilise in the program.

> The hardware is a 486 @ 100MH with 16MB of memory.

> With BP targeted towards PROTECTED mode the largest HEAP size I can
> get (MemAvail command) is around 1MB. I require more than this for a couple
> of large arrays.

> DOS HIMEM.SYS loaded.
> All the Borland DPMI and RTM is in the correct Place.
> A DOS MEM /C command shows 13MB of free extended memory.

> Can anyone help with information on how memory is allocated between DOS, the
> Borland runtime environment, etc.

> Thanks Ian Upton

Re:DOS and Borland Pascal memory size


Quote
On Wed, 8 Sep 1999, enztec wrote:
> free pascal (fpc ) allowz much larger arrays than does bpc/tpc 7.0 and
> it will run on the system you have - I have some very large code running
> on 486's.

> Delphi 2.0 (dcc32) (Borland Pascal 9.0) can handle [1..10000],[1..10000]
> fpc gives a 'Load error: no DPMI memory' error at [1..4000],[1..4000]

That is because a Windows Dos box only allows you to use 64MB of DPMI
memory (if you set it at that value, I believe the default is even only
16MB). Use the Win32 version of the compiler to compile Win32 programs and
you won't have those problems (or run your programs under real Dos, not in
a dos box).

Quote
> with fpc [1..3000],[1..3000] it appears to be using the disk drive for
> virtual memory usage??

FPC simply requests memory from the operating system, it's up to that one
whether it uses virtual memory or not.

Quote
> fpc runs [1..2000],[1..2000] (optimized) in 4.62 seconds on a P166 Cyrix
> dcc32 runs [1..2000],[1..2000] in 14.92 seconds on a P166 Cyrix

That's nice :)

Jonas

Re:DOS and Borland Pascal memory size


Quote
Jonas Maebe wrote:
> That is because a Windows Dos box only allows you to use 64MB of DPMI
> memory (if you set it at that value, I believe the default is even
> only 16MB).

Could you please tell me where I can set the DPMI value to 64 MB. The
fpc documents - say that it is 4MB but expands to use the total
available on it's own. Is this not happening?

Quote
> Use the Win32 version of the compiler to compile Win32
> programs and you won't have those problems (or run your programs under
> real Dos, not in a dos box).

Running in real dos is not a real option as I would lose all access to
my network.
But when I ran it in real dos (no windows loaded at all) it went to disk
(under OS control?) even for the low array size [1..2000],[1..2000] and
performance was horrible - 50% increase in time.

Could you please tell me if I can run the fpc Win32 version from a Dos
box, as I only program at the command line but use windows 95 for access
to network drives and 32 bit features.

I am sorry to not install win32 version before asking this and seeing
for myself, but I refrain from loading windows 95 software unless I have
to, for fear that the win95 registry will not be returned to the way it
was before loading the win95 based software - if I decide to uninstall
it.

May I assume this memory problem situation disappears under Linux - a
true 32 bit OS NOT running on top of an 8 bit OS (dos).

Quote
> > with fpc [1..3000],[1..3000] it appears to be using the disk drive
> > for virtual memory usage??

> FPC simply requests memory from the operating system, it's up to that > one whether it uses virtual memory or not.

In real dos mode I assume you mean command.com - Have you had any
experience with the fpc compiler running under the 4dos.com command.com
replacement OS??

Quote
> > fpc runs [1..2000],[1..2000] (optimized) in 4.62 seconds on a P166
> > Cyrix
> > dcc32 runs [1..2000],[1..2000] in 14.92 seconds on a P166 Cyrix

> That's nice :)

I am really glad it isn't the other way around!!! My tests on real
floating point division also show a 2.5 times benefit to fpc over bpc
and even dcc32.

Re:DOS and Borland Pascal memory size


Quote
Jonas Maebe wrote:

> > fpc runs [1..2000],[1..2000] (optimized) in 4.62 seconds on a P166 Cyrix
> > dcc32 runs [1..2000],[1..2000] in 14.92 seconds on a P166 Cyrix

> That's nice :)

No, it's plain misrepresentation. Delphi strings are completely
different beast and are "long": using reference counting and dynamic
memory allocation.

For a *sensible* speed comparison, try using the Delphi shortstring
type.

MH.

--
Martin Harvey.
mc...@harvey27.demon.co.uk
http://www.harvey27.demon.co.uk/mch24/

Re:DOS and Borland Pascal memory size


On Wed, 8 Sep 1999 12:51:12 +1000, "Ian Upton" <upt...@mpx.com.au>
wrote:

Quote
>I have a simple application which will be run on old hardware in the middle
>of athletic tracks and therefore I am using DOS and Borland Pascal V7.0.

>I am having troubles with memory and need assistance in understanding how
>much memory I can utilise in the program.

>The hardware is a 486 @ 100MH with 16MB of memory.

>With BP targeted towards PROTECTED mode the largest HEAP size I can
>get (MemAvail command) is around 1MB. I require more than this for a couple
>of large arrays.

>DOS HIMEM.SYS loaded.
>All the Borland DPMI and RTM is in the correct Place.
>A DOS MEM /C command shows 13MB of free extended memory.

>Can anyone help with information on how memory is allocated between DOS, the
>Borland runtime environment, etc.

In the DOC subdirectory of your BP directory there should be a file
called 'dpmiuser.doc' which describes some of the features of the
Borland DPMI system, especially the two DOS environment variables:

  SET RTM=[Option nnnn]

and

  SET DPMIMEM= ...

Another source of trouble may be your memory manager (EMM386, QEMM...)
or DMPI server (Win3x enhanced, Win9X, QDPMI.SYS ...).

The IDE menu COMPILE/INFORMATION lists under 'protected/free' the
currently available DPMI memory, the MEM extended memory size is only
a hint; you can have much less or much more (with a RTM swap file) BP
protected mode memory.

Hope that helps

Wolfgang

--
In order to e-mail me a reply to this message, you will have
to remove PLEASE.REMOVE from the address shown in the header.

Re:DOS and Borland Pascal memory size


Gentlefolk,

Thanks for all the assistance.

It has been some tome since I looked at this project and when (as sugessted
in one response) I found a SET SPMIxxx=2MB down in the AUTOEXEC.BAT.

Removed that and wow, lots of memory in the program.

Thanks for the info on Linux and delphi. All usefull but the environment for
this application (old hardware, middle of an aths track, unskilled users
(very)) a simple system such as DOS and one program is all that is required.

With regard to large arrays I have a BP unit from E.V.Sorokin which provides
arrays up to the maximum memory available. Goes well.

Once again, thanks for the assistance.

Ian Upton.

Quote
Ian Upton <upt...@mpx.com.au> wrote in message

news:7r4jfr$i8k$1@news1.mpx.com.au...
Quote
> I have a simple application which will be run on old hardware in the
middle
> of athletic tracks and therefore I am using DOS and Borland Pascal V7.0.

> I am having troubles with memory and need assistance in understanding how
> much memory I can utilise in the program.

> The hardware is a 486 @ 100MH with 16MB of memory.

> With BP targeted towards PROTECTED mode the largest HEAP size I can
> get (MemAvail command) is around 1MB. I require more than this for a
couple
> of large arrays.

> DOS HIMEM.SYS loaded.
> All the Borland DPMI and RTM is in the correct Place.
> A DOS MEM /C command shows 13MB of free extended memory.

> Can anyone help with information on how memory is allocated between DOS,
the
> Borland runtime environment, etc.

> Thanks Ian Upton

Re:DOS and Borland Pascal memory size


Where is the misrepresentation?? lol
I use the same program just the different compilers.

It sounds like you are really saying that fpc has a better algorithm for
AnsiStrings than bpc/tpc 7.0 does. Isn't that what the comparison shows?

Don't both compilers use dynamic allocation?

Your argument is like saying - if I test umbrellas and yours doesn't
hold up in the rain - you tell me that it a bad test and I should test
them in the sun - well I want to test them in the RAIN under the
conditions I want to use the umbrellas/program!

I don't want to use shortstrings, I want to use AnsiStrings and test the
difference in how fast the compiled code for each compiler handles
AnsiStrings.

By the way - how does fpc handle AnsiStrings? If you don't know it then
you shopuldn't say anything.

Quote
Martin Harvey wrote:

> Jonas Maebe wrote:

> > > fpc runs [1..2000],[1..2000] (optimized) in 4.62 seconds on a P166 Cyrix
> > > dcc32 runs [1..2000],[1..2000] in 14.92 seconds on a P166 Cyrix

> > That's nice :)

> No, it's plain misrepresentation. Delphi strings are completely
> different beast and are "long": using reference counting and dynamic
> memory allocation.

> For a *sensible* speed comparison, try using the Delphi shortstring
> type.

Re:DOS and Borland Pascal memory size


Quote
On Thu, 9 Sep 1999, enztec wrote:
> Where is the misrepresentation?? lol
> I use the same program just the different compilers.

But they have different defaults.

Quote
> It sounds like you are really saying that fpc has a better algorithm for
> AnsiStrings than bpc/tpc 7.0 does. Isn't that what the comparison shows?

TP/BP don't have ansistrings.

Quote
> Don't both compilers use dynamic allocation?

For ansistrings, yes. For shortstrings, no.

Quote
> I don't want to use shortstrings, I want to use AnsiStrings and test the
> difference in how fast the compiled code for each compiler handles
> AnsiStrings.

Then add this to the top of your program:

{$ifdef fpc}
{$mode delphi}
{$endif fpc}
{$h+}

This forces FPC into Delphi compatibility mode and ansistrings on (so if
you declare a variable as string, it is interpreted as an ansistring).

Jonas

Re:DOS and Borland Pascal memory size


Quote
On Wed, 8 Sep 1999, Martin Harvey wrote:
> > > fpc runs [1..2000],[1..2000] (optimized) in 4.62 seconds on a P166 Cyrix
> > > dcc32 runs [1..2000],[1..2000] in 14.92 seconds on a P166 Cyrix

> > That's nice :)

> No, it's plain misrepresentation. Delphi strings are completely
> different beast and are "long": using reference counting and dynamic
> memory allocation.

I thought that inb {$h+} mode (default) string = ansistring and in {$h-}
string = shortstring under Delphi? To get the strings you talk about, you
have to specify LongString as type identifier afaik (and I do mean afaik,
I have very little knowledge about Delphi).

Note that LongStrings are not yet fully implemented in FPC.

Quote
> For a *sensible* speed comparison, try using the Delphi shortstring
> type.

Or put {$h+} at the top of the source.

Jonas

Re:DOS and Borland Pascal memory size


Quote
Jonas Maebe wrote:

> On Thu, 9 Sep 1999, enztec wrote:

> > Where is the misrepresentation?? lol
> > I use the same program just the different compilers.

> But they have different defaults.

> > It sounds like you are really saying that fpc has a better algorithm for
> > AnsiStrings than bpc/tpc 7.0 does. Isn't that what the comparison shows?

> TP/BP don't have ansistrings.

I am sorry - we were discussing Delphi and fpc - I said tp/bp when I
meant delphi - I have stopped using bp/tp - only delphi and fpc now

Quote
> > I don't want to use shortstrings, I want to use AnsiStrings and test the
> > difference in how fast the compiled code for each compiler handles
> > AnsiStrings.

> Then add this to the top of your program:

> {$ifdef fpc}
> {$mode delphi}
> {$endif fpc}
> {$h+}

> This forces FPC into Delphi compatibility mode and ansistrings on (so > if you declare a variable as string, it is interpreted as an ansistring).

I have -Sh set in the ppc386.cfg file - same thing??

Re:DOS and Borland Pascal memory size


Quote
Jonas Maebe wrote:
> I thought that in {$h+} mode (default) string = ansistring and in
> {$h-} string = shortstring under Delphi?

True.

Quote
> To get the strings you talk about, you have to specify LongString as
> type identifier afaik (and I do mean afaik, I have very little
> knowledge about Delphi).

I run delphi with default (H+) and I get the string treatment I want -
string is considered an AnsiString. I don't declare string longstring.

Quote
> Note that LongStrings are not yet fully implemented in FPC.

I just started converting my delpi programs over to fpc and they have a
range check problem with -H+ in ppc386.cfg.

in fpc :
var s : string;

and it gives

and unhandled exception occurred at 0000BA8E
Range check error

the string it bombs on is 152221 characters long length(s)  - It works
on a string 9382 characters - I don't know its' limit but it is
somewhere in between. (64K??)

Other Threads