Wenn man viel
RAM und ein 64Bit-BS hat, kann man das Programm-Limit von 2GB höher setzen.
Das geht bei 32Bit- und 64Bit-EXE.
Zitat:
This program demonstrates how to use up to 2.5 GB of
RAM on the 32bit versions of Windows XP Prof. and Server 2003 and up to 3.5 GB of
RAM on the 64bit versions of Windows XP, Vista, Server 2003 and 2008. This is accomplished by instructing the Delphi linker to set the IMAGE_FILE_LARGE_ADDRESS_AWARE flag set in the EXE header of the 32bit app.
http://cc.embarcadero.com/Item/24309
Dafür braucht man nur eine Directive im .DPR-File:
Delphi-Quellcode:
program Project2;
uses
Vcl.Forms,
Unit2
in '
Unit2.pas'
{Form2};
const
IMAGE_FILE_LARGE_ADDRESS_AWARE = $0020;
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm2, Form2);
Application.Run;
end.
unit Unit2;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.StdCtrls;
type
TForm2 =
class(TForm)
Label1: TLabel;
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.FormCreate(Sender: TObject);
var
p: Pointer;
n: Int64;
begin
p := Pointer($D0000000);
//= 3.489.660.928, Above the 2GB line; and the 3GB line!
p := VirtualAlloc(p, 1024, MEM_COMMIT
or MEM_RESERVE, PAGE_READWRITE);
if p =
nil then
RaiseLastWin32Error;
n := Cardinal(p);
Label1.Caption:= IntToHex(n, 16);
end;
end.