V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  xiaozhaoz  ›  全部回复第 2 页 / 共 2 页
回复总数  34
1  2  
2016-10-09 23:08:23 +08:00
回复了 algas 创建的主题 Linux Linux 多线程程序虚拟内存占用过大有什么问题吗?
error 6,7 指的是用户空间写物理内存异常。不是 signal x

现在可以肯定,是不是 oom

你这个问题好查,每次异常的 eip 都相同,都是 0x4034f3 ,所以反汇编,根据偏移可以推算到代码,才能确切定位是什么问题。
2016-10-09 14:59:19 +08:00
回复了 algas 创建的主题 Linux Linux 多线程程序虚拟内存占用过大有什么问题吗?
@WKPlus ,

overcommit 的意思是是否允许过量使用虚存。

所以
0 是不予许,也就是超过一定的虚存会分配失败,但是一个复杂的算法计算上限。
1 是允许, 也就是虚存可以一直分配下去,知道进程的地址空间,或者 oom 发生。
2 是老模式, 就是 ( 50% * 物理内存) + swap 计算虚存使用上限。
2016-10-09 14:50:45 +08:00
回复了 algas 创建的主题 Linux Linux 多线程程序虚拟内存占用过大有什么问题吗?
@WKPlus

The Linux kernel supports the following overcommit handling modes

0 - Heuristic overcommit handling. Obvious overcommits of
address space are refused. Used for a typical system. It
ensures a seriously wild allocation fails while allowing
overcommit to reduce swap usage. root is allowed to
allocate slightly more memory in this mode. This is the
default.

1 - Always overcommit. Appropriate for some scientific
applications. Classic example is code using sparse arrays
and just relying on the virtual memory consisting almost
entirely of zero pages.

2 - Don't overcommit. The total address space commit
for the system is not permitted to exceed swap + a
configurable amount (default is 50%) of physical RAM.
Depending on the amount you use, in most situations
this means a process will not be killed while accessing
pages but will receive errors on memory allocation as
appropriate.

Useful for applications that want to guarantee their
memory allocations will be available in the future
without having to initialize every page.
2016-10-09 14:40:04 +08:00
回复了 algas 创建的主题 Linux Linux 多线程程序虚拟内存占用过大有什么问题吗?
@ryd994 通过楼主提供的信息,收到是 signal 11 。 所以初步认为是 overcommit , 而不是 oom , oom 是 signal 9.
2016-10-09 14:37:10 +08:00
回复了 algas 创建的主题 Linux Linux 多线程程序虚拟内存占用过大有什么问题吗?
楼主的 overcommit_memory 设置是 0 , 所以该程序的虚拟内存 overcommit limit 是动态计算的, 不是 66G 。
如果 overcommit_memory == 2, 超过 66G 会立即异常。
2016-10-09 14:35:27 +08:00
回复了 algas 创建的主题 Linux Linux 多线程程序虚拟内存占用过大有什么问题吗?
@ryd994
如果楼主是 ps 命令看到的 VSZ , 那就是虚拟内存。
VSZ virtual memory size of the process in KiB (1024-byte units). Device mappings are currently excluded

楼主确实没说清楚。
如果整个系统只占用 80G RSS ,一般不会 OOM ,但内存 zone 情况不好说。
所以 dmesg 或者 /var/下面的 log 看一眼才能确定。
2016-10-09 14:19:46 +08:00
回复了 algas 创建的主题 Linux Linux 多线程程序虚拟内存占用过大有什么问题吗?
CommitLimit: 65957680 kB
Committed_AS: 151684 kB

单一进程,最多只允许 malloc() 66G 虚拟内存, 超过就会 malloc 失败。

echo 1 > /proc/sys/vm/overcommit_memory

再试试看。
2016-10-09 14:09:26 +08:00
回复了 algas 创建的主题 Linux Linux 多线程程序虚拟内存占用过大有什么问题吗?
cat /proc/meminfo , 贴出来看看
2016-10-09 14:06:19 +08:00
回复了 algas 创建的主题 Linux Linux 多线程程序虚拟内存占用过大有什么问题吗?
确认系统 /proc/sys/vm/overcommit_* 设置。

overcommit* 控制了进程占用虚拟空间 和 系统物理内存的关系。
2016-09-07 16:39:53 +08:00
回复了 heat 创建的主题 问与答 有懂经济学的朋友么?简单分析下现状呗
流动性陷阱。经济不好时期的典型现象。

优先考虑避险,而不是投资增值,特别是房产这种泡沫严重的奢侈品。

避险优先考虑经济先企稳国家的货币, 比如美元。
2016-09-07 16:01:28 +08:00
回复了 Nexvar 创建的主题 程序员 编译一个 C 写的项目,最长花了多久时间
曾经有个项目, IVB i5 机器上, 启用 ccache , 因为头文件和配置变化,基本上重新编译, 编译一次 11 个小时。
2016-08-08 15:28:54 +08:00
回复了 Ryans 创建的主题 Docker 如何看待王垠评价 Docker ?
就事论事, 这个说法只说到了 docker 的很小一部分,即只说到了 docker 的文件系统运行环境的隔离, 这是一个静态资源的隔离。

docker 整个设计思想, 首先是成为一个新的标准交付件, 然后是一个动态执行资源的隔离。 文件系统静态资源的隔离,只覆盖了交付件的一部分特性。
2016-07-26 09:30:37 +08:00
回复了 visonme 创建的主题 程序员 技术牛的标准是什么,欢迎大家讨论。
公司里面, 他的领域, 所有问题搞不到找他都能搞定, 专业技术牛。
不是他的领域, 其他人都搞不定, 找他能搞定大部分, 技术牛。

大的专业社区,聚集了业内大牛开发社区, 如 Linux kernel , hadoop 中间件等, 能独立提交 RFC, 并实现合入 upstreaming 的, 业界大牛。
2016-06-01 18:50:39 +08:00
回复了 jamesarch 创建的主题 问与答 一意孤行做 C/Linux 系统底层是否有前途?
过来人给点建议, 做这个已经快 15 年了, 内核也提交过一些 patch ,底层东西玩了不少, 包括 cpu 设计,内核,编译器,系统库。

做底层有兴趣就坚持去做,但要做好准备, 门槛高, 收入低。
如果不坚持,等不到回报的那天。
为了让自己坚持的更久,也要懂一些应用层的东西, 到后面你可能会发现, 懂底层是你的优势,但养活自己还要靠应用。

而在系统底层之上, 还有不少好玩的,有前途的东西。
比如大数据的中间件, 深度学习的算法和模型。 这些都是极有前途,又有难度的东西。
1  2  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1803 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 24ms · UTC 16:32 · PVG 00:32 · LAX 09:32 · JFK 12:32
Developed with CodeLauncher
♥ Do have faith in what you're doing.