- 论坛徽章:
- 0
|
本帖最后由 白菜饺子馅 于 2016-08-02 18:23 编辑
由于代码涉及到多线程并发,计划使用共享内存作为通信机制。
数据量挺大,哪怕是临时存储也需要大量空间。
但是创建内存大小超过65536 * 4时就会失败,返回Invalid argument。
linux系统中的限制数值为shmall 2097152(约为65536 * 32) shmmax 33554432(约为65536 * 512) shmmni 4096。
查找perl语言相关函数介绍也没有发现说有限制。百度上也没有找到相关信息,搞不清楚怎么回事,还请各位高手不吝赐教。
附上相关代码:
use IPC::SysV qw(IPC_PRIVATE IPC_RMID IPC_CREAT S_IRUSR S_IWUSR);
my $mem_size = 65536*4 + 1;
my $key = "1992";
my $share = shmget($key,$mem_size ,IPC_CREAT|0777);
if (!defined($share) or !($share)){
log("create a shared memory to store the rate failed !\n", "debug" ;
}
报错信息为create a shared memory to store the rate failed :Invalid argument
谢谢! |
|