can ftruncate be used to increase the size of shared memory block beyond the shared memory limit size given by sysconfig? How do I make it use swap in case physica开发者_Go百科l memory runs out?
can ftruncate be used to increase the size of shared memory block ...
ftruncate()
resizes a file. It does not resize a memory mapping of that file. So, the answer is no.
... beyond the shared memory limit size given by sysconfig?
That limit can not be breached. root
user can change that limit though.
How do I make it use swap in case physical memory runs out?
Assuming it is a memory mapped file, one way is to only map parts of the file at a time, rather than the whole file. If a process uses more virtual memory than there is available physical memory the operating system is going to automatically use swapping to free some physical memory for you.
精彩评论