试图找到泄漏!对于pmap来说,anon意味着什么? [英] Trying to locate a leak! What does anon mean for pmap?

查看:7134
本文介绍了试图找到泄漏!对于pmap来说,anon意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找到我的内存在linux中运行的java进程的位置。有人建议我使用pmap -x来确切了解内存的作用。

I'm trying to locate where my memory has gone for a java process running in linux. Someone suggested I use pmap -x to see exactly what the memory is doing.

输出真的很长但基本上很重要的部分是重复这个:

The output is really long but basically a good portion of it is a repeat of this:

00007fbf75f6a000    1016       -       -       - rwx--    [ anon ]
00007fbf76068000      12       -       -       - -----    [ anon ]

这究竟是什么意思?为什么我有这么多的条目(4000 +)?

What exactly does this mean? Why do I have so many entries of this (4000+)?

推荐答案

Anon块是通过malloc分配的大块或者mmap - 查看联机帮助页。因此,它们与Java堆无关(除了整个堆应该存储在这样一个块中的事实)。

Anon blocks are "large" blocks allocated via malloc or mmap -- see the manpages. As such, they have nothing to do with the Java heap (other than the fact that the entire heap should be stored in just such a block).

根据我的经验,线程堆栈也使用anon块。如果你看到很多anon块都具有相同的大小,并且该大小为512k到4Mb(对于我运行的Tomcat进程,下面的示例重复了十几次),这可能是原因。根据程序的不同,您可能需要多达几十个;如果你看到数千,这意味着你有线程问题。

In my experience, thread stacks also use anon blocks. If you see a lot of anon blocks that all have the same size, and that size is 512k to 4Mb (the example below is repeated over a dozen times for a Tomcat process that I have running), that's the likely cause. Depending on the program, you may have up to a few dozen of these; if you're seeing thousands, it means you have a problem with threading.

b089f000    504K rwx--    [ anon ]
b091d000     12K -----    [ anon ]
b0920000    504K rwx--    [ anon ]
b099e000     12K -----    [ anon ]
b09a1000    504K rwx--    [ anon ]
b0a1f000     12K -----    [ anon ]

但这留下了一个问题:为什么您使用 pmap 来诊断Java内存问题吗?

But that leaves a question: why are you using pmap to diagnose a Java memory issue?

这篇关于试图找到泄漏!对于pmap来说,anon意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆