问题描述
当我使用GarbageCollectorMXBean打印垃圾收集的详细信息时,输出将显示以下信息:-
When I am printing the details of garbage collection using GarbageCollectorMXBean the output shows me the following information:-
Name: PS ScavengeCollection
count: 72
Collection time: 3041
Memory Pools: PS Eden Space PS Survivor Space
Name: PS MarkSweepCollection
count: 5
Collection time: 4922
Memory Pools: PS Eden Space PS Survivor Space PS Old Gen
现在非常正确地,ScavengeCollection和MarkSweep集合涵盖了5个可用内存池中的4个,但不包括
Now quite rightly the ScavengeCollection and MarkSweep collection covers 4 of the 5 available memory pool excluding
我想知道为什么垃圾收集从来没有参加过
I want to know why the Garbage Collection never ran for
是否暗示GC永远不会从CodeCacheManager内存池中垃圾收集对象?
Does it imply that GC never garbage collect objects from CodeCacheManager Memory Pool??
相同的意义吗?
推荐答案
阅读 MemoryMXBean .特别是有关非堆内存
方法区域在逻辑上是堆的一部分,但是是Java虚拟的 机器实施可以选择不进行垃圾收集或 压缩它.与堆类似,方法区域可以是固定的 大小,或者可能会缩小.方法区域的内存 不需要是连续的.
The method area is logically part of the heap but a Java virtual machine implementation may choose not to either garbage collect or compact it. Similar to the heap, the method area may be of a fixed size or may be expanded and shrunk. The memory for the method area does not need to be contiguous.
除方法区域外,还有Java虚拟机实现 可能需要内存进行内部处理或优化,这也 属于非堆内存.例如,JIT编译器要求 用于存储从Java转换的本机代码的内存 虚拟机代码以实现高性能.
In addition to the method area, a Java virtual machine implementation may require memory for internal processing or optimization which also belongs to non-heap memory. For example, the JIT compiler requires memory for storing the native machine code translated from the Java virtual machine code for high performance.
您问非堆内存中有什么?
What falls into Non-Heap Memory you ask?
永久生成:该池包含虚拟机本身的所有反射数据,例如类和方法对象.对于使用类数据共享的Java VM,这一代被分为只读和读写区域.
Permanent Generation: The pool containing all the reflective data of the virtual machine itself, such as class and method objects. With Java VMs that use class data sharing, this generation is divided into read-only and read-write areas.
代码缓存:HotSpot Java VM还包括代码缓存,其中包含用于编译和存储本机代码的内存.
Code Cache: The HotSpot Java VM also includes a code cache, containing memory that is used for compilation and storage of native code.
这篇关于垃圾收集未针对代码缓存内存池运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!