Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extend the stack size on macOS Sierra

When I try to extend the stack size on macOS Sierra using the command ulimit -s unlimited the terminal print the next message:

-bash: ulimit: stack size: cannot modify limit: Operation not permitted.

I also tried to use sudo ulimit -s unlimited but it doesn't leave me either. Anyone know something?

like image 767
Pablo Aragonés Avatar asked Feb 18 '17 12:02

Pablo Aragonés


People also ask

What is the stack size in Macos?

On Mac OS X, the default stack size for non-main threads created using pthread_create is fixed at 512KB and cannot be altered by any calls to, for example, setrlimit. This means that threads created by GRPC to handle requests have a relatively small stack size (the main thread has a 8MB stack by default).

Can stack size increase?

The stack size actually allocated can grow on modern desktop operating systems. In practice it is implemented in terms of the memory management unit. As memory is accessed beyond the current committed pages of the stack, new memory pages are committed in.

What is Max stack size?

The default maximum stack size of threads created in a native IIS process is 256 KB. Article. 01/24/2022.


1 Answers

There is a hard limit for the stack size on OS X that can be seen running:

ulimit -Hs

This is the maximum you can set the stack size as. So instead of unlimited the best you can do is

ulimit -s 65532

See this question for more details.

like image 55
JamesFurness Avatar answered Nov 15 '22 03:11

JamesFurness