Java Non Heap Memory和Stack Memory有什么区别?如果不是,它们是否相同?两者之间有什么区别? [英] What is the difference between Java Non Heap Memory and Stack Memory? Are they Same if not what is the difference between them?

查看:188
本文介绍了Java Non Heap Memory和Stack Memory有什么区别?如果不是,它们是否相同?两者之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Jconsole监视Java应用程序.内存标签显示了不同的堆和非堆内存,例如

I am using Jconsole for monitoring a Java Application. The memory tab shows different Heap and Non Heap memories like

  1. 堆内存使用情况
  2. 非堆内存使用情况
  3. "CMS Old Gen"内存池
  4. 内存池"Par Eden Space"
  5. 内存池"Par Survivor Space"
  6. 内存池代码缓存"
  7. 内存池"CMS Perm Gen"

这些术语之间有什么区别.还请提供一些有关-如何通过监视这些参数来发现应用程序行为异常的信息.

What is the difference between these terms. Also please provide some information regarding - how to find anomalies in the application behavior by monitoring these parameters.

推荐答案

在所有基于C的语言(和大多数其他语言)中,基本上有三类存储:

There are essentially three categories of storage in all C-based languages (and most other languages):

  1. 堆栈
  2. 静态(有多种变化)

您熟悉的堆.

您也熟悉的堆栈,但您只是不知道.当您具有带有局部"变量的方法时,这些变量将在调用框架"中分配.调用方法时分配调用框架",从方法返回时将其删除,因此,最有效的方法是使用随调用而增长而随返回而收缩的堆栈".

Stack you're also familiar with, but you just don't know it. When you have a method with "local" variables, those variables are allocated in a "invocation frame". The "invocation frame" is allocated when you call the method and deleted when you return from the method, and hence it's most efficiently implemented using a "stack" that grows with call and shrinks with return.

静态是您没有明确分配的东西,并且从程序开始执行时就已经存在.

Static is stuff that you don't explicitly allocate and essentially exists from the time program execution begins.

堆栈所需的空间通常很小,并且在上面的类别中与非堆内存"结合在一起.

The space required for stack is generally fairly small and is lumped in with "Non Heap Memory" in the categories above.

这篇关于Java Non Heap Memory和Stack Memory有什么区别?如果不是,它们是否相同?两者之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆