2

I understand from other posts here that "IMAGE_FILE_LARGE_ADDRESS_AWARE" may work to effectively expand memory availability in e.g. Delphi 2007.

I don't get this to work in Delphi6, is this indeed the case, or should it work? Or is there an alternative command that does the same thing?

If not, I may need to migrate to a later version of Delphi. Then, does anyone know what the most recent version of Delphi is that would easily allow me to migrate my existing code (ideally, my existing code, which is fairly simple Turbo Pascal-type code, would just work as is) AND would support the "IMAGE_FILE_LARGE_ADDRESS_AWARE" 'trick' to expand memory?

Many thanks!

Remco

  • Although it pains to state the obvious, it's probably also worth being sure that there are no memory leaks or heap corruption issues, etc. If you're not sure why you are running out of memory then it is vitally important that you understand the cause. Fixing the problem by throwing a larger address space at it will only work if you know you have a justifiable need for that memory. Even if the need is justified and required, often a simple refactoring can dramatically reduce memory pressure in an application just by changing your allocation and usage strategy. – J... Mar 08 '16 at 17:09

1 Answers1

8

You can apply the IMAGE_FILE_LARGE_ADDRESS_AWARE PE flag to a Delphi 6 application, but you must beware of the following issues:

  • The default memory manager for Delphi 6, the Borland memory manager, does not support memory allocations with addresses above 2GB. You must replace the memory manager with one that supports large addresses. For instance FastMM.
  • Your code may well contain pointer truncation bugs that will need to be found and fixed.
  • The same goes for any third party software that you use. This includes the Borland RTL and VCL libraries. I did not encounter many problems with these libraries, but it may be that your program uses different parts of the runtime libraries that have pointer truncation bugs.
  • In order to stress test your program under large address conditions you should turn on top down memory allocation. Do not be surprised if your anti-malware software (or indeed other system level software) has to be disabled whilst you operate in top down memory allocation mode. This type of software is notoriously poor at operating in top down memory allocation mode.
  • Finally, it is worth pointing out that large address aware cannot solve all out of memory problems. All it does is open up the top half of the 32 bit address space. Your program might require even more address space than that. In which case you'd need to either re-design your program, or move to a 64 bit compiler.
Community
  • 1
  • 1
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490