简体   繁体   English

无法跟踪 Linux 中的内存泄漏

[英]Unable to track memory leak in Linux

I have a realtime application RTMP based streaming application which if run, leaks memory.我有一个基于实时应用程序 RTMP 的流应用程序,如果运行它会泄漏内存。 Unfortunately I can't run it through valgrind since it is a live application不幸的是,我无法通过 valgrind 运行它,因为它是一个实时应用程序

Here are the issues 1. Application PID memory stays constant to 3.8% even after hours 2. Kernel memory through slabtop remains constant 3. In meminfo, I see available memory keeps reducing!以下是问题 1. 即使在数小时后,应用程序 PID 内存仍保持恒定为 3.8% 2. 通过 Slabtop 的内核内存保持不变 3. 在 meminfo 中,我看到可用内存不断减少!

How do I know who is taking up this memory?我怎么知道谁在占用这个内存? I'm suspecting TCP buffer or something like that.我怀疑 TCP 缓冲区或类似的东西。 Can someone pls help?有人可以帮忙吗?

It's impossible for us to say where are you leaking with only the information provided.仅凭所提供的信息,我们不可能说你在哪里泄漏。

If you can't use Valgrind, what I suggest is that you try to isolate various functionalities/modules of your program.如果您不能使用 Valgrind,我建议您尝试隔离程序的各种功能/模块。 Then, try to disable/enable those modules to see if there's is a leak or not when you disable/enable it.然后,尝试禁用/启用这些模块以查看禁用/启用它时是否存在泄漏。

For example, try to disable the networking module of your application, to see if it continues to leak or not.例如,尝试禁用应用程序的网络模块,看看它是否继续泄漏。 This way you can probably narrow the problem to one/various modules and not the entire application.通过这种方式,您可能可以将问题缩小到一个/多个模块而不是整个应用程序。

I found the rootcause.我找到了根本原因。 Setting tcp memory in Linux to 32MB was causing the problem.将 Linux 中的 tcp 内存设置为 32MB 是导致问题的原因。 Reset it to 87KB which is the default value in Centos 7.2将其重置为 87KB,这是 Centos 7.2 中的默认值

Not sure why setting it to high value should cause the issue不知道为什么将其设置为高值会导致问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM