MantisBT - CMake
View Issue Details
0012437CMakeCMakepublic2011-08-31 13:012013-07-01 09:37
Glenn Coombs 
David Cole 
normalminoralways
closedfixed 
MicrosoftWindows7
CMake 2.8.5 
CMake 2.8.11CMake 2.8.11 
0012437: Default link line includes massive stack size of 10M with the /STACK:10000000 option
Projects configured by cmake for Visual Studio 2008 (and 2010) set a default stack size of 10M. This is quite a large value for a default stack size and causes multi threaded programs to die with an "out of memory" error message.

We use the SystemC library in our programs and it is quite common to have programs with between 50 and 200 threads. With 10M per thread that uses anything from 500M up to 2G of memory just for the thread stacks.

Can the cmake MSVC generators be changed to not add the /STACK option at all by default ? That way MSVC users would get the same stack size when using cmake configured projects as they would get for non cmake configured projects.
Create a minimal project like the one given below in the additional information section and then run cmake to configure it for Visual Studio 2008. Open the generated solution in Visual Studio 2008 and check the "Properties=>Linker=>Command Line" section. You will see that the link line specifies a stack size of 10M with the /STACK:10000000 option.
cmake_minimum_required(VERSION 2.8)

project(foo)

file(WRITE foo.c "int main(int argc, char *argv[]) { return 0; }\n")

add_executable(foo foo.c)
No tags attached.
related to 0013912closed Brad King Incorrect settings for Embarcadero compiler 
Issue History
2011-08-31 13:01Glenn CoombsNew Issue
2012-08-11 11:38David ColeStatusnew => backlog
2012-08-11 11:38David ColeNote Added: 0030301
2012-11-09 07:49David ColeTarget Version => CMake 2.8.11
2012-11-20 17:11David ColeAssigned To => David Cole
2012-11-20 17:11David ColeStatusbacklog => assigned
2012-11-23 13:24David ColeNote Added: 0031690
2012-11-23 13:24David ColeStatusassigned => resolved
2012-11-23 13:24David ColeFixed in Version => CMake 2.8.11
2012-11-23 13:24David ColeResolutionopen => fixed
2013-02-13 13:03Brad KingRelationship addedrelated to 0013912
2013-07-01 09:37Robert MaynardNote Added: 0033420
2013-07-01 09:37Robert MaynardStatusresolved => closed

Notes
(0030301)
David Cole   
2012-08-11 11:38   
Sending old, never assigned issues to the backlog.

(The age of the bug, plus the fact that it's never been assigned to anyone means that nobody is actively working on it...)

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it: http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer who has the bandwidth to take it on, and ferry a fix through to our 'next' branch for dashboard testing.
(0031690)
David Cole   
2012-11-23 13:24   
Fix pushed and merged to the 'next' branch:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=51af1da3d21b95540888d585fccdaa8d68d1fdd8 [^]
(0033420)
Robert Maynard   
2013-07-01 09:37   
Closing resolved issues that have not been updated in more than 4 months.