I will appreciate any help on the following.
Please reply to as well.
I am trying to program something that use huge integer matrices,
say 100x1500. I can do it in Unix pascal, but the Unix machines are slow.
I also have borland pascal 7.0, but all I could there is matrices with about
65,000 entries, which is much less than I need.
Is there any way to extend the memory allowance in turbo pascal?
Is there any version of Pascal for PC such that I can deal with matrices in the same way I can do it in Unix Pascal?
Thanks,
Sveta

Dani AI

Generated

Short answer: the 65,000-ish limit you hit is the old 64K data-segment constraint of 16-bit Turbo/Borland Pascal, not a fundamental inability to hold a 100×1500 matrix in RAM. 100×1500 = 150,000 entries. In Turbo Pascal an Integer is 2 bytes → ~300,000 bytes (≈293 KiB). In modern 32-bit/64‑bit Pascal an Integer is typically 4 bytes → ~600,000 bytes. (scribd.com)

If you must stay in TP/BP under DOS, the practical workaround is to keep big data off the DGROUP (static data). Allocate on the heap (GetMem/New or per-row allocation) so the DGROUP only stores a few pointers while the bulk lives on the heap — that’s exactly the idea behind ’s suggestion. Also adjust the heap with the compiler/IDE memory option ($M / command-line) and always check MemAvail/handle allocation failures and FreeMem/Dispose when done. The TP manual explains the 64K DGROUP limit and heap usage. (studylib.net)

A much simpler path is to use a 32‑ or 64‑bit Pascal compiler (Free Pascal / Lazarus or Delphi). With dynamic arrays you can allocate the whole matrix easily and portably with SetLength, and you won’t fight segments:

var
  M: array of array of Integer;
begin
  SetLength(M, 100, 1500);
  M[0,0] := 42;
end;

This is easier to write, safer, and runs far faster on modern hardware. (docwiki.embarcadero.com)

If you absolutely need a single contiguous block larger than 64K on very old systems, look into DOS extenders / “huge” memory units or OS APIs that return large handles (advanced, less portable). For most uses today the right choice is to move to a 32/64-bit Pascal compiler or — if staying in DOS — allocate rows on the heap and manage them carefully. (midnightbeach.com)

I will appreciate any help on the following.
Please reply to as well.
I am trying to program something that use huge integer matrices,
say 100x1500. I can do it in Unix pascal, but the Unix machines are slow.
I also have borland pascal 7.0, but all I could there is matrices with about
65,000 entries, which is much less than I need.
Is there any way to extend the memory allowance in turbo pascal?
Is there any version of Pascal for PC such that I can deal with matrices in the same way I can do it in Unix Pascal?
Thanks,
Sveta

You might try Free Pascal.

Free Pascal Home

Free Pascal Arrays

type
i1500 = array[1..1500] of integer;
var
iarray: array[1..100] of ^i1500;

for j:=1 to 100 do new(iarray[j]);

access [j,k] with iarray[j]^[k]


I will appreciate any help on the following.
Please reply to as well.
I am trying to program something that use huge integer matrices,
say 100x1500. I can do it in Unix pascal, but the Unix machines are slow.
I also have borland pascal 7.0, but all I could there is matrices with about
65,000 entries, which is much less than I need.
Is there any way to extend the memory allowance in turbo pascal?
Is there any version of Pascal for PC such that I can deal with matrices in the same way I can do it in Unix Pascal?
Thanks,
Sveta

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.