Search code examples
iphoneheap-memorystack-memory

How the size of stack and heap memory bound is determined in iPhone OS?


How is internally the maximum size of stack and Heap is set? How can we determine its maximum size? I am not using it for any of my projects. But this is just out of curiosity.


Solution

  • iPhone/iOS has support for virtual memory (just no backing store in normal use), and a virtual address space much larger than physical RAM. So the maximum size for either stack or heap is until the sum of all (maybe dirty) memory use (in allocated pages) runs out of that available for the current app process/sandbox, which will vary depending on what else is running on the system.