Why does mmap fail on iOS?

后端 未结 4 1858
醉话见心
醉话见心 2021-02-07 15:26

I\'m trying to use mmap to read and play audio files on iOS. It works fine for files up to about 400MB. But when I try a 500MB file, I get a ENOMEM error.

char *         


        
4条回答
  •  Happy的楠姐
    2021-02-07 15:58

    Use NSData and dont touch mmap directly here.

    To get the advantages of faulting reads, use NSDataReadingMapped. NSData ALSO frees bytes when in low-mem situations

提交回复
热议问题