Knowledgebase: Compilation
6.x: I get "Out of memory" errors when building my (large) project
Posted by Aleksandr Alekseev on 14 January 2012 00:19
Problem:
When I build my project in Delphi or C++ Builder IDE - I get "Out of memory" error message.

Explanation:
Building your project with EurekaLog means that your project must be post-processed by EurekaLog. EurekaLog should insert options and debug information in your executable file (compiled project).

Project's compilation as well as project's post-processing is done inside IDE. Which means that compilation and post-processing will use the resources of IDE process. IDE hosts your project, source code, editor, components, packages, IDE experts, system DLLs, code completion cache, and many other things.

A 32-bit process is limited to 2 Gb of address space ("memory"). Delphi or C++ Builder IDE are 32-bit applications. So, Delphi and C++ Builder IDE are limited to 2 Gb of code and data.

Thus, if you have many components or IDE extensions installed ("code") and your project(s) is large ("data") - then IDE may have no space available to complete compilation and/or post-processing. That's why you see "Out of memory" error message.

Note: 2 Gb limit does NOT depend on your installed RAM memory or operating system bitness - it's always 2 Gb. This limit holds if you have 512 Mb of physical memory installed on 32-bit Windows XP. And this limit holds if you have 8 Gb of physical memory installed on 64-bit Windows 7.

Workaround:
Uninstall unused packages, components, IDE extensions.

If you opened a project group - try to close it, restart IDE, then open and build each project one-by-one.

Solution:
1. Quick and simple: go to "Project"/"EurekaLog project options" IDE menu item, switch to "Build Options" tab and enable the "Use EurekaLog 7 compiler" checkbox.

To know more about possible advantages and drawbacks of this method - please see this article.

2. Alternatively, you use another method:
  • Go to "Project"/"EurekaLog project options" and export your project settings (via "Export" button) into standalone .eof file. For example: Options.eof
  • Go to "Components"/"Install packages", find EurekaLog IDE package and remove it.
  • Create PostProcess.bat file in your project's folder. Use the following content:
    @echo off
    "C:\Program Files (x86)\Embarcadero\RAD Studio\8.0\bin\ecc32.exe" --el_config"Options.eof" --el_alter_exe"YourProject.dpr;YourProject.exe"
  • Adjust file paths to ecc32.exe according to your Delphi installation. C++ Builder: replace 'ecc32' to 'emake'. Change file names if necessary (like 'Options.eof', 'YourProject.dpr', 'YourProject.exe'). Please, see this article for more information.
  • Now you should call this PostProcess.bat file after each project compilation:
    • Delphi 2007 and above: insert "PostProcess.bat" into "Post-Build Commands" box under "Build Events" tab in project options.
    • Delphi 2006 and below: run PostProcess.bat manually after each compilation or use a 3rd party extension for automatic calling.

Checked EL version: 6.x.

Help Desk Software by Kayako Resolve