HotSpot heap & non-heap memory

本文深入解析Java运行时数据区的管理机制,包括堆内存、非堆内存的不同区域及其作用。探讨了垃圾回收机制如何工作,并介绍了EdenSpace、SurvivorSpace、TenuredGeneration等关键概念。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Heap memory

The heap memory s the runtime data area from which the Java VM allocates memory for all class instances and arrays. The heap may be of a fixed or variable size. The garbage collector is an automatic memory management system that reclaims heap memory for objects.

  • Eden Space : The pool from which memory is initially allocated for most objects.

  • Survivor Space : The pool containing objects that have survived the garbage collection of the Eden space.

  • Tenured Generation : The pool containing objects that have existed for some time in the survivor space.

Non-heap memory

Non-heap memory includes a method area shared among all threads and memory required for the internal processing or optimization for the Java VM. It stores per-class structures such as a runtime constant pool, field and method data, and the code for methods and constructors. The method area is logically part of the heap but, depending on the implementation, a Java VM may not garbage collect or compact it. Like the heap memory, the method area may be of a fixed or variable size. The memory for the method area does not need to be contiguous.

  • 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.

  • Code Cache : The HotSpot Java VM also includes a code cache, containing memory that is used for compilation and storage of native code.

Rerference:

http://docs.oracle.com/javase/6/docs/technotes/guides/management/jconsole.html

Tuning Garbage Collection (JDK 1.5)

Garbage Collection FAQ (JDK 1.4)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值