What's the max file mapping size in 64bits machine

后端 未结 5 1293
情话喂你
情话喂你 2021-01-12 15:55

I\'m new to 64-bits architecture. Could you tell me what\'s MAX file size supported by file mapping in 64 bits linux machine. I want to open more than 20GB files by file map

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-12 16:25

    From the mmap(2) man page:

       void *mmap(void *addr, size_t length, int prot, int flags,
                  int fd, off_t offset);
    

    length is a size_t, which on 64-bit machines is 64 bits in length. Therefore yes, you can theoretically map a 20GB file.

提交回复
热议问题