0

I want 1 MB sized NSData object with all bytes set to 255.

Method where I want to run this code crashes on EXC_BAD_ACCESS:

const size_t size = 1024 * 1024;
uint8_t bytes[size] = {[0 ...size - 1] = 255};
NSData *data = [NSData dataWithBytes:bytes length:size];
NSLog(@"%@", data);
user500
  • 4,519
  • 6
  • 43
  • 56

1 Answers1

0

To close the question here is the answer.

Doc says, that stack size is 1 MB for main thread in iOS.

christophercotton
  • 5,829
  • 2
  • 34
  • 49
user500
  • 4,519
  • 6
  • 43
  • 56