MantisBT - CMake
View Issue Details
0013912CMake(No Category)public2013-02-13 10:312013-07-01 09:37
Mathäus Mendel 
Brad King 
normalmajoralways
closedfixed 
Windows7
CMake 2.8.10.2 
CMake 2.8.11CMake 2.8.11 
0013912: Incorrect settings for Embarcadero compiler
The configuration file used for Embarcadero compiler - Windows-Embarcadero.cmake, at Modules/Platform folder - has incorrect settings. The variable 'CMAKE_EXE_LINKER_FLAGS_INIT' is set as "${_tM} -lS:10000000 -lSc:10000000 ", overriding the default configuration for stack and heap allocation/commit.
The issue can be reproduced using a binary that allocates a lot of memory in a short time span, running on a system with memory pagination disabled. The memory commit size will increase and the system will hang or become unstable.
The ideal configuration to be passed to the linker would be:

set (CMAKE_EXE_LINKER_FLAGS_INIT "${_tM} -lS:1048576 -lSc:4098 -lH:1048576 -lHc:8192")

It will force the linker to use the default settings for stack and heap memory allocation/usage.
No tags attached.
related to 0012437closed David Cole Default link line includes massive stack size of 10M with the /STACK:10000000 option 
Issue History
2013-02-13 10:31Mathäus MendelNew Issue
2013-02-13 13:02Brad KingNote Added: 0032258
2013-02-13 13:03Brad KingRelationship addedrelated to 0012437
2013-02-13 13:03Brad KingNote Added: 0032259
2013-02-13 13:05Brad KingNote Added: 0032260
2013-02-13 13:11Mathäus MendelNote Added: 0032262
2013-02-13 13:47Mathäus MendelNote Added: 0032267
2013-02-13 13:57Brad KingNote Added: 0032268
2013-02-13 13:57Brad KingAssigned To => Brad King
2013-02-13 13:57Brad KingStatusnew => resolved
2013-02-13 13:57Brad KingResolutionopen => fixed
2013-02-13 13:57Brad KingFixed in Version => CMake 2.8.11
2013-02-13 13:57Brad KingTarget Version => CMake 2.8.11
2013-07-01 09:37Robert MaynardNote Added: 0033421
2013-07-01 09:37Robert MaynardStatusresolved => closed

Notes
(0032258)
Brad King   
2013-02-13 13:02   
For reference, the history of the current flags lies in these commits from 2003:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c70beb4b [^]
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1b572eb9 [^]
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2d411398 [^]

The large stack size was added to MS tools back then also. However, that was removed recently:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=51af1da3 [^]

A similar change is in order for Embarcadero tools.
(0032259)
Brad King   
2013-02-13 13:03   
Also for reference, here is documentation of the flags in question:

http://docwiki.embarcadero.com/RADStudio/XE3/en/ILINK32.EXE,_the_32-bit_Incremental_Linker [^]

/H:xxxx Specifies application heap reserve size in hex or decimal. Minimum
         value is 0. This switch overrides the HEAPSIZE setting in a module
         definition file. Default is 1 MB (0x1000000).
                                            0x100000 = 1048576
/HC:nnnn Specifies application heap commit size.
/S:xxxx Specifies application stack reserve size.
/Sc:xxxx Specifies application stack commit size.
(0032260)
Brad King   
2013-02-13 13:05   
Interestingly the default listed in the documentation for /H:xxxx says 1MB in words but the value given is actually 16MB. We'll have to assume the extra 0 in the value is a typo.

While I'm not opposed to the new defaults you propose, what is wrong with just leaving the flags out completely as is now done for MS and Intel tools?
(0032262)
Mathäus Mendel   
2013-02-13 13:11   
Because the Embarcadero compiler has wrong default values too. If you leave the parameters empty, it will use another stack/heap size. I'm still not sure why, but we are instrumenting the compiler and our test machines to better understand the case.

As we didn't want to put random values, we just set the default ones mentioned in the documentation; the entire system now works.
(0032267)
Mathäus Mendel   
2013-02-13 13:47   
In the Module Definition documentation, both stack and heap values are mentioned:

http://docwiki.embarcadero.com/RADStudio/XE3/en/Module_Definition_Files#HEAPSIZE_Statement [^]
http://docwiki.embarcadero.com/RADStudio/XE3/en/Module_Definition_Files#STACKSIZE_Statement [^]
(0032268)
Brad King   
2013-02-13 13:57   
Fix applied:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=188b0e9e [^]

Thanks for the detailed information and answers.
(0033421)
Robert Maynard   
2013-07-01 09:37   
Closing resolved issues that have not been updated in more than 4 months.