If you receive that exception, and you are using something like:

...
var
Buffer: array [0..MAX_SIZE] of Char;

Than MAX_SIZE is too big, because Char can take small mount of data.

Use better something like this:

{
The following example opens a file of your choice and reads
the entire file into a dynamically allocated buffer. The
buffer and the size of the file are then passed to a routine
that processes the text, and finally the dynamically
allocated buffer is freed and the file is closed.
}

procedure TForm1.Button1Click(Sender: TObject);
var
F: file;
Size: Integer;
Buffer: PChar;
begin
if OpenDialog1.Execute then
begin
AssignFile(F, OpenDialog1.FileName);
Reset(F, 1);
try
Size := FileSize(F);
GetMem(Buffer, Size);
try
BlockRead(F, Buffer^, Size);
Memo1.Lines.Add(Buffer);
finally
FreeMem(Buffer);
end;
finally
CloseFile(F);
end;
end;
end;
 

That code is taken from Delphi help, system.FreeMem function.