线程内存地址大于物理RAM

时间:2019-06-08 09:10:56

标签: java multithreading out-of-memory

我试图了解Java NMT提供的内存映射。我试图确定是否遇到this博客文章(TL; DR-Java堆太接近用于线程之类的非堆内存顶部的问题了,尝试创建更多线程,但出现OOM错误。

这是jcmd {pid} VM.native_memory detail scale=MB输出的一部分:

Virtual memory map:

[0x00000000c2400000 - 0x0000000100000000] reserved 988MB for Java Heap from
    [0x00007fc34a953f12] ReservedSpace::initialize(unsigned long, unsigned long, bool, char*, unsigned long, bool)+0xc2
    [0x00007fc34a9548ee] ReservedHeapSpace::ReservedHeapSpace(unsigned long, unsigned long, bool, char*)+0x6e
    [0x00007fc34a92199b] Universe::reserve_heap(unsigned long, unsigned long)+0x8b
    [0x00007fc34a7d7d44] ParallelScavengeHeap::initialize()+0x84

[0x0000000100000000 - 0x0000000140000000] reserved 1024MB for Class from
    [0x00007fc34a953f12] ReservedSpace::initialize(unsigned long, unsigned long, bool, char*, unsigned long, bool)+0xc2
    [0x00007fc34a95414b] ReservedSpace::ReservedSpace(unsigned long, unsigned long, bool, char*, unsigned long)+0x1b
    [0x00007fc34a735320] Metaspace::allocate_metaspace_compressed_klass_ptrs(char*, unsigned char*)+0x40
    [0x00007fc34a7377ff] Metaspace::global_initialize()+0x4cf


[0x00007fc2e2d08000 - 0x00007fc2e2e09000] reserved and committed 1MB for Thread Stack from
    [0x00007fc34a906304] JavaThread::run()+0x24
    [0x00007fc34a7b6ea8] java_start(Thread*)+0x108

[0x00007fc2e2e09000 - 0x00007fc2e2f0a000] reserved and committed 1MB for Thread Stack from
    [0x00007fc34a906304] JavaThread::run()+0x24
    [0x00007fc34a7b6ea8] java_start(Thread*)+0x108

[0x00007fc2e2f0a000 - 0x00007fc2e300b000] reserved and committed 1MB for Thread Stack from
    [0x00007fc34a906304] JavaThread::run()+0x24
    [0x00007fc34a7b6ea8] java_start(Thread*)+0x108

该起始位置(0x00007fc2e2d08000)约为140GB,但我在计算机上只有4GB的物理内存。我如何在内存中找到一个范围为0x00007fc2e2d08000-0x00007fc2e2e09000的线程?

真的是0x00007fc2e2d08000是虚拟内存地址的情况吗?

如何找到线程的真实地址以确认我没有遇到the blog post中描述的问题?

这也是我的top输出-它表明我们没有使用任何交换空间,因此唯一使用的内存确实是物理内存。

top - 11:08:07 up 5 days, 25 min,  3 users,  load average: 0.05, 0.12, 0.09
Tasks: 131 total,   1 running, 130 sleeping,   0 stopped,   0 zombie
%Cpu(s): 10.3 us,  1.8 sy,  0.0 ni, 87.5 id,  0.2 wa,  0.0 hi,  0.0 si,  0.2 st
KiB Mem:   4044792 total,  3789788 used,   255004 free,    63868 buffers
KiB Swap:        0 total,        0 used,        0 free.  1575428 cached Mem

0 个答案:

没有答案