JVM Java Vitual Machine

Quote from website:  http://www.artima.com/insidejvm/ed2/jvm6.html


The Heap

Whenever a class instance or array is created in a running Java application, the memory for the newobject is allocated from a single heap. As there is only one heap inside a Java virtual machine instance, allthreads share it. Because a Java application runs inside its "own" exclusive Java virtual machine instance,there is a separate heap for every individual running application. There is no way two different Javaapplications could trample on each other's heap data. Two different threads of the same application,however, could trample on each other's heap data. This is why you must be concerned about propersynchronization of multi-threaded access to objects (heap data) in your Java programs.

The Java virtual machine has an instruction that allocates memory on the heap for a new object, but hasno instruction for freeing that memory. Just as you can't explicitly free an object in Java source code, youcan't explicitly free an object in Java bytecodes. The virtual machine itself is responsible for decidingwhether and when to free memory occupied by objects that are no longer referenced by the runningapplication. Usually, a Java virtual machine implementation uses a garbage collector tomanage the heap.

关于java生成对象的堆:

每一个java application分配了一个heap, 并在这个堆上为新的对象分配空间。多个县城可共同访问这个堆上的空间。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值