After updating Embarcadero C++ Builder to a new version, our project suddenly fails to build. This happens just with one of our projects. For the most of the team members, identical code builds without errors. On my computer, linking fails every time.
In Build tab:
[ilink32] Fatal: Out of memory
In Output tab:
Build FAILED.
c:\program files (x86)\embarcadero\studio\18.0\Bin\CodeGear.Cpp.Targets(3517,5): error : Fatal: Out of memory
There is no more information.
If I enable Link with Dynamic RTL, the project links without errors. For example, if our Debug target has that setting enabled, the project links in Debug but not in Release.
How can I fix this problem? How do I give more memory for the linker?
On your computer, one of the linker heaps is too small for this project. The project links with Link with Dynamic RTL option, because in that case the linker needs less memory, and the heap just happens to be large enough.
You can use -GH
linker option to increase that heap, but first you have to find out which heap overflows. To do that, enable diagnostic output in the linker.
Compiling from the command line:
call rsvars
MSBuild /v:diag YourProject.cbproj
Compiling from the IDE:
Near the end of the output, you should find sizes of heaps, similar to this:
The "ILINK32" task is using "ilink32" from "c:\program files (x86)\embarcadero\studio\18.0\bin\ilink32.exe".
Turbo Incremental Link 6.75 Copyright (c) 1997-2016 Embarcadero Technologies, Inc.
Overrun on linker heap: tds
Linker Heaps
------------
system 0x030d4000 0x08000000
tds 0x08710000 0x09400000
c:\program files (x86)\embarcadero\studio\18.0\Bin\CodeGear.Cpp.Targets(3517,5): error : Fatal: Out of memory
The command exited with code 2.
In this case, overflow happened in heap tds
, so we need to increase its size. The left column gives the number of bytes in use, and the right column gives the number of bytes allocated. The new size should be larger than the value that is currently in the right column.
In this case, tds
size was 0x09400000
, so we increase it to 0x0f400000
with the following option: -GHtds=0x0f400000
.
In the IDE, go to Project > Options > C++ Linker. Add -GHtds=0x0f400000
to Advanced > Additional Options.
After saving project options, compile the project again. If the same heap overflows, you need to increase its size even more. If another heap overflows, you need to increase its size as well.
For example, if code
heap overflows now, and you want to increase its size to 0x0a000000
, you should change Additional Options to -GHtds=0x0f400000 -GHcode=0x0a000000
.
If you increase the heap too much, you will get LME288 error instead. That means you have reached the maximum size for some heap. If even the maximum size is not enough for your project, it seems C++ Builder 10.2.3. has doubled the maximum size, so you could migrate to that version, or copy ilink32.exe
from 10.2.3. installation to use with an older version of C++ Builder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With