What is the difference between Java Non Heap Memory and Stack Memory? Are they Same if not what is the difference between them?(Java 非堆内存和栈内存有什么区别?它们是否相同,如果不同,它们之间有什么区别?)
问题描述
我正在使用 Jconsole 来监控 Java 应用程序.内存选项卡显示不同的堆和非堆内存,例如
I am using Jconsole for monitoring a Java Application. The memory tab shows different Heap and Non Heap memories like
- 堆内存使用情况
- 非堆内存使用情况
- 内存池CMS Old Gen"
- 内存池Par Eden Space"
- 内存池Par Survivor Space"
- 内存池代码缓存"
- 内存池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):
- 堆
- 堆栈
- 静态(有多种变体)
你熟悉的堆.
您也熟悉堆栈,但您不知道.当您有一个带有局部"变量的方法时,这些变量会在调用框架"中分配.调用帧"在调用方法时分配,从方法返回时删除,因此使用随调用增长并随返回收缩的堆栈"最有效地实现.
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 非堆内存和栈内存有什么区别?它们是否相同,如果不同,它们之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Java 非堆内存和栈内存有什么区别?它们是否相同,如果不同,它们之间有什么区别?
基础教程推荐
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 降序排序:Java Map 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- Java:带有char数组的println给出乱码 2022-01-01