# Memory mapping limitations on iOS

**URL:** <https://forum.juce.com/t/memory-mapping-limitations-on-ios/33119>\
**Category:** General JUCE discussion\
**Created:** [April 29, 2019, 2:19pm UTC](https://forum.juce.com/t/memory-mapping-limitations-on-ios/33119 "2019-04-29T14:19:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![monocasual](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/monocasual/32/1056_2.png) [@monocasual](https://forum.juce.com/u/monocasual)\
**Post date:** [April 29, 2019, 2:19pm UTC](https://forum.juce.com/t/memory-mapping-limitations-on-ios/33119/1 "2019-04-29T14:19:12Z")

</div>

Hi all,

I’m currently playing with memory-mapped files on iOS 12.2. If I load a large file, say around 2 gb, and try to map it entirely, `mmap` fails with error `ENOMEM` (i.e. “No memory is available”).

I’m aware of virtual memory limitations on 32-bit systems, but I’m working with a 5th generation iPad which is 64-bit by nature. On top of that I’m pretty sure I’m building the app for arm64 - just double-checked it on XCode.

Can you confirm this behavior? Is there actually a limitation on how much virtual memory you can use on iOS or am I just missing something?

---

<div class="post-metadata">

**Author:** ![RolandMR](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/rolandmr/32/641_2.png) [@RolandMR](https://forum.juce.com/u/RolandMR)\
**Post date:** [April 29, 2019, 2:57pm UTC](https://forum.juce.com/t/memory-mapping-limitations-on-ios/33119/2 "2019-04-29T14:57:43Z")

</div>

Yes, there is a limit on iOS to how much virtual memory you can use. The system is quite limited compared to a desktop OS VM system. Only read-only pages can be paged out. Back in the day each process was limited to about 700 MB of VM, might be higher now, I haven’t done iOS stuff in a while.

---

<div class="post-metadata">

**Author:** ![monocasual](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/monocasual/32/1056_2.png) [@monocasual](https://forum.juce.com/u/monocasual)\
**Post date:** [April 29, 2019, 3:48pm UTC](https://forum.juce.com/t/memory-mapping-limitations-on-ios/33119/3 "2019-04-29T15:48:45Z")

</div>

@RolandMR the limit seems a bit higher now - around 2 GB according to my empirical tests, the same amount of physical memory. At least on my model.

I wonder how other DAWs like Cubasis or GarageBand handle big audio files: if `mmap`ed, they would surely trigger the 2GB limit soon. I’m pretty sure you can create projects way larger than that…
