Win64 memory limited - attempting to allocate 8GB lazarus / 8-Other ---------------------------------------------------------------------- SteveAnderson · 2007-09-19 15:36 Hi there Anyone know why this code works for 3 clicks (0.5GB per click), then the pointer returned is NIL? System RAM is 8GB on XP x64. According the the MS docs, win64 should give 8TB to a 64bit app if the LARGE_ADDRESS_AWARE flag is set in the exe. So i've added {$SetPEFlags $20}. Is the cross-compiler stripping the flag? Code: [Select]unit Unit1; {$mode objfpc}{$H+} interface uses   Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,windows; type   { TForm1 }   TForm1 = class(TForm)     Button1: TButton;     ListBox1: TListBox;     procedure Button1Click(Sender: TObject);   private     { private declarations }   public     { public declarations }   end; var   Form1: TForm1; implementation { TForm1 } {$SetPEFlags $20} // large address aware flag procedure TForm1.Button1Click(Sender: TObject); var p:pointer; begin      p:=pointer(GlobalAlloc(GMEM_FIXED,1024*1024*512));      //p:=pointer(LocalAlloc(LMEM_FIXED,1024*1024*512));      listbox1.items.add(inttostr(sizeof(p)));      listbox1.items.add(inttostr(qword(p)));      application.processmessages;      fillchar(p^,1024*1024*512,0);      end; initialization   {$I Unit1.lrs} end. ---------------------------------------------------------------------- felipemdc · 2007-09-19 16:20 Please ask on the fpc mailling list. This forum is mostly dedicated to the lazarus ide and lazarus component libraries. You will get better answers about this on the fpc mailling list. http://www.hu.freepascal.org/maillist.var