Is the stack size of iPhone fixed?

后端 未结 2 602
闹比i
闹比i 2021-01-11 16:16

When I am trying to adjust of stack size of threads:

- (void)testStack:(NSInteger)n {
    NSThread *thread = [[NSThread alloc]initWithTarget:self selector:@s         


        
2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-11 16:56

    The stack size is bounded on the device, and in most cases cannot exceed 1MB for the main thread on iPhone OS, nor can it be shrunk.

    The minimum allowed stack size for secondary threads is 16 KB and the stack size must be a multiple of 4 KB. The space for this memory is set aside in your process space at thread creation time, but the actual pages associated with that memory are not created until they are needed.

提交回复
热议问题