mmap的大小限制是多少 [英] what is the size limit for mmap
问题描述
我正在使用mmap()
将共享内存对象映射到进程.我的问题分为两部分:
I am using mmap()
to map a shared memory object to a process. My question has two parts:
1)mmap()
到Linux进程的大小限制是多少? (有这样的限制吗?)
1) what is the size limit for mmap()
to a linux process? (is there such limit?)
2)进程运行了一段时间后,我认为进程虚拟内存地址空间将以某种方式分散.这会影响我在此过程中可以做的最大尺寸mmap()
吗?
2) after the process running a while, I think the process virtual memory address space will be somehow fragmented. Will this impact the max size I can do mmap()
in this process?
使用的linux内核是2.6.27
.共享内存对象的大小约为32MB.我试图访问由于没有足够的虚拟地址空间而导致此类共享内存对象出现mmap()
失败的可能性.
The linux kernel used is 2.6.27
. The size of the shared memory object is around 32MB. I am trying to access what is the possibility that mmap()
fails with such shared memory object due to no enough virtual address space.
推荐答案
mmap
的大小没有限制,但将取决于给定进程使用的现有地址空间.但是强烈建议您不要mmap
到较大的连续虚拟地址空间.另一个建议是在访问特定的物理地址(或设备地址)并完成映射后使用mmap
即时".
There is no restriction on mmap
size but would depend on the existing address space used by the given process. But it is highly suggested that you dont mmap
to a large contiguous virtual address space. Another suggestion would be to use the mmap
"just-in-time" when a specific physical address (or a device address) is accessed and unmap once done
这篇关于mmap的大小限制是多少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!