回复帖子:(barrypp)呃....现在拿不出证据。感觉上会影响...

用户名:   *您没有注册?
密码:   *忘记论坛密码?    标题采用“回复:XXX....”
验证码 点击获取验证码
主题标题:  *不得超过 200 个汉字
当前心情
上一页 发帖表情 下一页
内容
  

主题最新回顾(发布时间:2017-2-27 15:15:00)
--  作者:lgz
--  
This file is not a means to control the growth of the various kernel caches
(inodes, dentries, pagecache, etc...)  These objects are automatically
reclaimed by the kernel when memory is needed elsewhere on the system.

Use of this file can cause performance problems.  Since it discards cached
objects, it may cost a significant amount of I/O and CPU to recreate the
dropped objects, especially if they were under heavy use.  Because of this,
use outside of a testing or debugging environment is not recommended.

上面是内核文档片段,不建议修改与caches相关的设置,随意修改反倒会影响系统性能,这些caches不会影响到你的程序的运行的


主题最新回顾(发布时间:2017-2-27 14:33:00)
--  作者:barrypp
--  
呃....现在拿不出证据。感觉上会影响性能。总之,有没有什么办法可以限制它么?比如限制disk cache只使用最多50%的内存。然后我想对比测试一下。
[此贴子已经被作者于2017-2-27 14:33:54编辑过]

主题最新回顾(发布时间:2017-2-27 12:52:00)
--  作者:lgz
--  
怎么影响了,这个机制不会影响程序获取内存空间

主题最新回顾(发布时间:2017-2-27 12:09:00)
--  作者:barrypp
--  
有没有办法限制它呢? 因为它确实影响了性能上的稳定性

主题最新回顾(发布时间:2017-2-27 11:40:00)
--  作者:lgz
--  
你好,这是并不是内存泄露,这是linux的disk canche机制,linux会将文件在内存中进行缓存,已加快文件(存储设备)读写,并不影响程序运行

主题最新回顾(发布时间:2017-2-24 16:36:00)
--  作者:barrypp
--  [讨论]观察到一个内存持续消耗/泄露?的问题
测试代码:
int main()
{
char buf[10240];
std:ofstream of;
of.open("/mnt/nfs/t.log",std::ios_base::app|std::ios_base::binary|std::ios_base::out);

while(1)
{
of.write(buf,10240);u
sleep(10e3);
}

}

运行后,不管用top还是free来查看,内存消耗都会持续上升直到只剩大约3M左右的内存

此时程序依旧可以继续运行。但是对复杂一点的程序来说,运行性能就不太稳定了。
[此贴子已经被作者于2017-2-24 16:41:38编辑过]