E2100 Data type too large exceeds 2 GB (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Error and Warning Messages (Delphi)

You have specified a data type which is too large for the compiler to represent. The compiler will generate this error for datatypes which are greater or equal to 2 GB in size. You must decrease the size of the description of the type.


program Produce;

  type
    EnormousArray = array [0..MaxLongint] OF Longint;
    BigRecord = record
      points : array [1..10000] of Extended;
    end;

  var
    data : array [0..500000] of BigRecord;

begin
end.

It is easily apparent to see why these declarations will elicit error messages.


program Solve;
  type
    EnormousArray = array [0..MaxLongint DIV 8] OF Longint;

    DataPoints = ^DataPointDesc;
    DataPointDesc = array [1..10000] of Extended;
    BigRecord = record
      points : DataPoints;
    end;

  var
    data : array [0..500000] OF BigRecord;


begin
end.

The easy solution to avoid this error message is to make sure that the size of your data types remain under 2Gb in size. A more complicated method would involve the restructuring of your data, as has been begun with the BigRecord declaration.