Linux mmap() ENOMEM error causing Segmentation Fault
2016-04-29 17:00
375 查看
I have a system that creates files on disk, then uses mmap and madvise and mflush to asynchronously do I/O to the disk. This system may potentially create many, many files, each of which will have three mmap sections, that will be rotated through the file.
After trying to run this system for a while, I started getting segmentation violations that I couldn't quite understand. Initially, I thought it was a threading problem, because I'm using boost::asio and boost::thread quite heavily. I used strace() to figure
out what the system was doing, and found that right before the crashes, one or more calls to mmap() would fail.
Long story short: There is a limit to the number of mmap() segments that can be active in a Linux process at any one time. This limit is configurable in /proc/sys/vm/max_map_count. I already knew there was a file descriptor limit, and I raised that pretty high,
but apparently Linux doesn't think you'll be using lots of mmap() just because you're using lots of files. Adding the following to /etc/rc.local will fix the problem:
echo 1000000 > /proc/sys/vm/max_map_count
本文转自:点击打开链接
After trying to run this system for a while, I started getting segmentation violations that I couldn't quite understand. Initially, I thought it was a threading problem, because I'm using boost::asio and boost::thread quite heavily. I used strace() to figure
out what the system was doing, and found that right before the crashes, one or more calls to mmap() would fail.
Long story short: There is a limit to the number of mmap() segments that can be active in a Linux process at any one time. This limit is configurable in /proc/sys/vm/max_map_count. I already knew there was a file descriptor limit, and I raised that pretty high,
but apparently Linux doesn't think you'll be using lots of mmap() just because you're using lots of files. Adding the following to /etc/rc.local will fix the problem:
echo 1000000 > /proc/sys/vm/max_map_count
本文转自:点击打开链接
相关文章推荐
- linux 查找目录或文件
- Linux下cmake使用简介
- Linux内核分析学习总结
- centos6.5环境基于conga的web图形化界面方式配置rhcs集群
- 在ArchLinux上安装单机版本kafka
- centos6.5环境基于conga的web图形化界面方式配置rhcs集群
- Linux下编写程序
- 高级字符驱动程序操作(Linux设备驱动程序)
- 7.Linux swap分区的使用,主引导记录(MBR)的备份、dd,df,du命令的使用
- Linux下端口被占用解决
- linux 搭建jenkins+创建maven工程JOB
- Linux正则表达式
- [Linux][Kerne][Tips] 在 minicom 下送出 SysRq
- Linux不同应用的代理设置
- 学习鸟哥的Linux私房菜基础篇总结(上)(0-9章)
- epoll-linux4.1.10
- Linux C++程序进行性能分析工具gprof使用入门
- rsync远程同步配置与使用
- linux系统被入侵后处理经历 推荐
- linux下java.io.IOException: Cannot run program "/opt/jdk/jre/bin/java": error=13, Permission denied