Stack size


#1

How is the stack size determined? if the stack ran out of room for additional functions would the stack automatically take more memory from the heap or would the program just crash?

I also dont understand why you would use malloc() to claim space from the heap for a struct. Because when using structs before I never used malloc() so was the struct created in a functions frame on the stack?


#2

The stack size is 8 MB by default:
developer.apple.com/library/mac/ … index.html

Yes, if you didn’t malloc the struct, it was allocated on the stack. (I mean, unless some function was calling malloc for you.)


#3

OK Thanks :slight_smile: