Re: Does file-mapping a memory allocation work around RAM limits?
Re: Does file-mapping a memory allocation work around RAM limits?
- Subject: Re: Does file-mapping a memory allocation work around RAM limits?
- From: Doug Hill <email@hidden>
- Date: Wed, 3 May 2017 23:27:23 -0700
> On May 3, 2017, at 6:21 PM, Rick Mann <email@hidden> wrote:
>
> Our iOS app works with very large data buffers (hundreds of MB). As you can imagine, we run into issues at times.
>
> I saw some sample code that used this technique, and it got me wondering if this actually works around the 600 MB limitation of some iOS devices (which begs another question: doss the large iPad Pro with 3GB of RAM also limit apps to 600 MB?).
>
> --
> Rick Mann
> email@hidden
The limits of mmap should be the limits of the file system. Well, technically it’s limited by the size_t parameter which I guess is OS specific. But these days it should be what the VFS can handle.
I just tried out this code snippet:
http://www.linuxquestions.org/questions/programming-9/mmap-tutorial-c-c-511265/ <http://www.linuxquestions.org/questions/programming-9/mmap-tutorial-c-c-511265/>
and set the size of the mapped file to 32GB Works fine on a Mac with 16GB of RAM.
It is SLOOOOOOWWWWWW however. You have to move all that data across a bus after all. If you need to load 3GB of data from your file, I recommend making it happen on a background thread. And make some lights blink and play a happy tune while the user waits.
Not sure what the limitation on some iOS devices you’re referring to. Is it dependent on the installed RAM? Are there other artificial limits?
Doug Hill
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden