ios - Is the stack size of iPhone fixed? -


when trying adjust of stack size of threads:

- (void)teststack:(nsinteger)n {     nsthread *thread = [[nsthread alloc]initwithtarget:self selector:@selector(dummy) object:nil];     nsuinteger size = 4096 * n;     [thread setstacksize:size];     [thread start]; }  - (void)dummy {     nsuinteger bytes = [[nsthread currentthread] stacksize];     nslog(@"%@", @(bytes)); }  - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {     // override point customization after application launch.     (nsinteger = 126; <= 130; i++) {         [self teststack:i];     }     return yes; } 

in output, size not changed:

2015-06-19 11:05:06.912 stack[52982:2082454] 524288 2015-06-19 11:05:06.913 stack[52982:2082457] 524288 2015-06-19 11:05:06.913 stack[52982:2082456] 524288 2015-06-19 11:05:06.913 stack[52982:2082458] 524288 2015-06-19 11:05:06.913 stack[52982:2082455] 524288 

is iphone stack size fixed?

p.s. testing above in iphone 6 plus, debug mode.

update: stack can adjusted when running in simulator on macbook:

2015-06-19 11:25:17.042 stack[1418:427993] 528384 2015-06-19 11:25:17.042 stack[1418:427994] 532480 2015-06-19 11:25:17.042 stack[1418:427992] 524288 2015-06-19 11:25:17.042 stack[1418:427991] 520192 2015-06-19 11:25:17.042 stack[1418:427990] 516096 

the stack size bounded on device, , in cases cannot exceed 1mb main thread on iphone os, nor can shrunk.

the minimum allowed stack size secondary threads 16 kb , stack size must multiple of 4 kb. space memory set aside in process space @ thread creation time, actual pages associated memory not created until needed.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -