The heap stores all of the objects created by your java program.The heap's contents is monitored by the garbage collector,which frees memory from the heap when you stop using an object. This is in contrast with the stack, which stores primitive types…
方法区 方法区存储虚拟机加载的类信息,常量,静态变量,即时编译器编译后的代码等数据.HotSpot中也称为永久代(Permanent Generation),(存储的是除了Java应用程序创建的对象之外,HotSpot虚拟机创建和使用的对象).为什么称为永久代呢?? 各个地方说的都不清楚,查看官方文档,解释为:永久代中的对象并不是永久的,只是历史上被叫做永久代罢了. In fact, the objects in it are not “permanent”, but that's what i…