AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Delphi 64 Speicherfragen

Ein Thema von BigAl · begonnen am 6. Feb 2014 · letzter Beitrag vom 19. Feb 2014
 
hathor
(Gast)

n/a Beiträge
 
#15

AW: Delphi 64 Speicherfragen

  Alt 19. Feb 2014, 20:34
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.

Geändert von hathor (19. Feb 2014 um 20:56 Uhr)
  Mit Zitat antworten Zitat
 

 

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:10 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz