I need to process non-sequential subsets of about 4.5 million records. Allowing a bit extra I have:
type
BallotData = record
BallotNumber : longint;
NumberOfPreferences : smallint;
Preferences : array[1..256] of smallint;
CurrentPreference : byte;
CurrentValue : double;
end;
The first attempt was to define:
var Ballots : array[1 .. 6000000] of BallotData;
From memory it compiled but failed in execution.
The second attempt was to spit up the array:
var Ballots : array[1 .. 3, 1 .. 2000000] of BallotData;
It compiled but generated meaningless output; for example, it referenced Ballots[1376268, 1638422] and a few seconds later I got:
An unhandled exception occurred at $000115B2:
EInOutError: File not open
$000115B2
I then tried splitting the array:
const
ArrayBallotNumbers = 800000;
var
BallotsGroup1 : array[1 .. ArrayBallotNumbers] of BallotData;
BallotsGroup2 : array[1 .. ArrayBallotNumbers] of BallotData;
BallotsGroup3 : array[1 .. ArrayBallotNumbers] of BallotData;
BallotsGroup4 : array[1 .. ArrayBallotNumbers] of BallotData;
BallotsGroup5 : array[1 .. ArrayBallotNumbers] of BallotData;
BallotsGroup6 : array[1 .. ArrayBallotNumbers] of BallotData;
This resulted in a compilation error:
ld: rel32 out of range in __start in __start from /usr/lib/crt1.o
An error occurred while linking
Error: /usr/local/bin/ppc386 returned an error exitcode
After some experimenting I found it works with ArrayBallotNumbers = 650000, but this is too small!
Is the problem with Free Pascal?
Or is it my computer, a first generation Mac desktop pro with a Quad-core 64 bit Intel Xeon, but EFI32 and Kernel mode 32 bit suggesting it might have problems addressing large arrays?