3

I have one application which is built using Delphi 5.0 and works fine without any issues. But when running large report my application needs more than 2 Gb memory. After doing analysis found that using Compiler directive SETPEFlags we can increase 32 bit application memory upto 4 GB.

I am trying to set in my program in Delphi 5.0 but getting error "Invalid Compiler Directive". Can somebody suggest any way to resolve without rebuilding application in other version. Or what version those got added to Delphi?

Thanks in advance.

Nalu
  • 1,107
  • 4
  • 20
  • 43

1 Answers1

6

You can't get the tools in Delphi 5 to mark your application as Large Address Aware ({$SetPEFlags} was added in Delphi 6). You need to add that PE flag as a post build setting. The usual way to set that flag is to use Microsoft's editbin tool.

Once you do this, your program will stop working as soon as you allocate memory beyond the 2GB boundary. That's because the default Borland memory manager does not support large addresses. You will need to replace it with FastMM or other LAA-capable memory manager. Or you can write your own replacement memory manager using, for instance, HeapAlloc(), if you wish.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • thats cool. Many thanks David. Used editbin to set flags and using FastMM for memory management and working as expected. – Nalu Sep 16 '16 at 21:04