Board index » delphi » memory alocation, the heap and stuff...

memory alocation, the heap and stuff...

hi

i am useing code to read file input and build a large string matrix
into memory. for that i use pointers to array[1..40] of string[40]
type, the maximum of lines is defined by file input. i was hopeing
that i could use all available memory useing alocated variables, but
my test program chrashes somewhere after the 500th alocated
array[1..40] of string[40] that's where i realized that Turbo Pascal
is alocating variables in the main memory. by useing byte alained date
i could double the number of alocated arrays, but that's not my point.
i was just starting to work with memory alocation and i got
disapointed. it's important to read all the file content in memory coz
havy computation is to be done on the data. i prefer to compile my
code under m$-dos, useing tp7. is there a way to alocate memory beyond
the 1st magabyte of ram? the tpx protected ide enviroment seems to be
avare of 64MB of ram but how do i use it?
the same problem is sorting relativly large text files. ms-dos
edit.com can load text files 6-7 MB large. what's the trick?

i hope my english is now to awful to understand the problem.

Vasko

 

Re:memory alocation, the heap and stuff...


"Vasko Altiparmakov" <spacerog...@yahoo.com> schreef in bericht
news:b052b774.0205072238.10c085e2@posting.google.com...

Quote
> hi

> i am useing code to read file input and build a large string matrix
> into memory. for that i use pointers to array[1..40] of string[40]
> type, the maximum of lines is defined by file input. i was hopeing
> that i could use all available memory useing alocated variables, but
> my test program chrashes somewhere after the 500th alocated
> array[1..40] of string[40] that's where i realized that Turbo Pascal
> is alocating variables in the main memory. by useing byte alained date
> i could double the number of alocated arrays, but that's not my point.
> i was just starting to work with memory alocation and i got
> disapointed. it's important to read all the file content in memory coz
> havy computation is to be done on the data. i prefer to compile my
> code under m$-dos, useing tp7. is there a way to alocate memory beyond
> the 1st magabyte of ram? the tpx protected ide enviroment seems to be
> avare of 64MB of ram but how do i use it?
> the same problem is sorting relativly large text files. ms-dos
> edit.com can load text files 6-7 MB large. what's the trick?

> i hope my english is now to awful to understand the problem.

> Vasko

I would have expected that TP gives you 640kB at max. There are ways to
make the expanded or extended DOS memory available but this is a lot of
trouble.
The best solution is to switch to BP. This is part of the Borland Pascal
professional package. You have to compile to protected mode where you can
use all the memory within 64 MB.
If  TPX is the same program as BPC you'll probably have to use the
command option -CP

For sorting text files you have to be more specific on what you want to
do.

-- Femme

Re:memory alocation, the heap and stuff...


Quote
> The best solution is to switch to BP.

Or use some free pascal compiler like FPC (www.freepascal.org) or TMT
(www.tmt.com)

Quote
> This is part of the Borland Pascal
> professional package. You have to compile to protected mode where you can
> use all the memory within 64 MB.
> If  TPX is the same program as BPC you'll probably have to use the
> command option -CP

Won't work, since TPX is only an enhanced IDE. It can compile larger
real Mode apps, but no Protected Mode code...

If you use TVISION, you can have streams which can use EMS, but BP or
other compilers with protected mode support are more easier...

Greetings

Markus

Re:memory alocation, the heap and stuff...


Quote
spacerog...@yahoo.com (Vasko Altiparmakov) wrote:
> is there a way to alocate memory beyond
> the 1st magabyte of ram? the tpx protected ide enviroment seems to be
> avare of 64MB of ram but how do i use it?
> the same problem is sorting relativly large text files. ms-dos
> edit.com can load text files 6-7 MB large. what's the trick?

The DOS sort can only sort files which are smaller than available memory
(below the 640K limit) (it could also use temporary files). Some editors use
the trick, that they only load part of the file into memory. One of my DOS
editors actually says "Waiting for disk" when I scroll through a large
(>185MB !!!) file (I have only 48MB RAM).

In order to use more memory you have to switch to EMS/XMS memory. You could
download the SWAG files (the address in the files is
http://www.gdsoft.com/swag/swag.html but it is an old address. I am not sure
it is good anymore). There you can find routines to access EMS/XMS.

Regards, Ren
--
Using Virtual Access
http://www.vamail.com

Re:memory alocation, the heap and stuff...


Quote
Markus Humm <markus.h...@freenet.de> wrote in message <news:3CD947D1.7080005@freenet.de>...
> > The best solution is to switch to BP.

> Or use some free pascal compiler like FPC (www.freepascal.org) or TMT
> (www.tmt.com)

> > This is part of the Borland Pascal
> > professional package. You have to compile to protected mode where you can
> > use all the memory within 64 MB.
> > If  TPX is the same program as BPC you'll probably have to use the
> > command option -CP

> Won't work, since TPX is only an enhanced IDE. It can compile larger
> real Mode apps, but no Protected Mode code...

i was hopeing that TPX is something better :?
bah, i'll just have to work with file instead of memory :(

Quote

> If you use TVISION, you can have streams which can use EMS, but BP or
> other compilers with protected mode support are more easier...

> Greetings

> Markus

Thanx for the information
Vasko

Re:memory alocation, the heap and stuff...


R. A. Larsen <r_lar...@image.dk> wrote in message <news:VA.0000017c.00192f75@r_larsen>...

Quote
> spacerog...@yahoo.com (Vasko Altiparmakov) wrote:
> > is there a way to alocate memory beyond
> > the 1st magabyte of ram? the tpx protected ide enviroment seems to be
> > avare of 64MB of ram but how do i use it?
> > the same problem is sorting relativly large text files. ms-dos
> > edit.com can load text files 6-7 MB large. what's the trick?

> The DOS sort can only sort files which are smaller than available memory
> (below the 640K limit) (it could also use temporary files). Some editors use
> the trick, that they only load part of the file into memory. One of my DOS
> editors actually says "Waiting for disk" when I scroll through a large
> (>185MB !!!) file (I have only 48MB RAM).

> In order to use more memory you have to switch to EMS/XMS memory. You could
> download the SWAG files (the address in the files is
> http://www.gdsoft.com/swag/swag.html but it is an old address. I am not sure
> it is good anymore). There you can find routines to access EMS/XMS.

> Regards, Ren

the address is functional. EMS is no good i think, unless is easier to
program than XMS. i think i'll do another algorithm that does not use
that mutch ram.

greetings Vasko

Re:memory alocation, the heap and stuff...


Quote

> the address is functional. EMS is no good i think, unless is easier to
> program than XMS. i think i'll do another algorithm that does not use
> that mutch ram.

> greetings Vasko

With EMS you simply map 16k blocks into the 1st megabyte of ram (in the
page frame) where you can do memory access like to conventional ram
(e.g. mem[$1234:$1234]:=5;)

More information about this gives Ralf Browns famous intlist here:

http://www-2.cs.cmu.edu/~ralf/files.html

Greetings

Markus

Other Threads