asdf
asdf

Reputation: 2441

Increase stack size with XCode

I developed a command line application on Linux which needs its stack to be increased. On Linux I just used the workaround: ulimit -s unlimited before running the program. On Mac OS X, command line with G++, I add to the compilation options:

-Wl,-stack_size,0x10000000

and it works.

Now I am developing this program with XCODE, where should I add this option?

Upvotes: 7

Views: 7277

Answers (2)

stackich
stackich

Reputation: 5297

The answer is yes, you can, but under certain conditions. Lets see what does the Swift documenation says about this.

var stackSize: Int { get set }

This value must be in bytes and a multiple of 4KB. To change the stack size, you must set this property before starting your thread. Setting the stack size after the thread has started changes the attribute size (which is reflected by the stackSize method), but it does not affect the actual number of pages set aside for the thread.

Upvotes: 0

cobbal
cobbal

Reputation: 70795

From the project window:

Targets > [Your target] > info > Build > Other Linker Flags > [your flags]

Upvotes: 8

Related Questions