在java堆转储中这些奇怪的类名是什么意思? [英] What do those strange class names in a java heap dump mean?

查看:372
本文介绍了在java堆转储中这些奇怪的类名是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在java进程中跟踪内存泄漏,使用 jmap jhat 每次我这样做,我会看到特定对象类型的奇怪的符号,如 [S 为字符串数组和 [C 字符数组。我不记得什么意思了,而且这很难google。



编辑):证明我的观点,事实证明 [S 是一组short, [C 是char数组。)



任何人都关心,列出所有不同的类名称和它们的含义?或者指向我这样的表?



具体来说,我想知道什么 [Ljava.lang.Object;

解决方案

您可以在 Class.getName()



< blockquote>

如果此类对象表示不是数组
类型的
引用类型,则返回类
的二进制名称,如em> Java™
语言规范,Second
版本。



如果此类对象表示
原始类型或void,那么返回的
的名称是一个 String 等于对应于
原始类型或void的Java
语言关键字。 p>

如果此类对象表示一个
类的数组,则内部
形式的名称由
的名称组成元素类型前面有一个或
多个'['字符,表示数组嵌套的
深度。元素类型名称的
编码为
如下:

 
元素类型编码
boolean Z
字节B
char C
类或接口L classname ;
double D
float F
int I
long J
short S



I'm trying to track down a memory leak in a java process, using jmap and jhat. Every time I do this I see those weird notation for specific object types, like [S for string arrays and [C for Character arrays. I never remember what means what, and it's very hard to google this stuff.

(EDIT: to prove my point, it turns out that [S is array of short and [C is array of char.)

Anyone care to make a table listing all the different class names and what they mean? Or point me to such table?

Specifically I'd like to know what [Ljava.lang.Object; means.

解决方案

You'll find the complete list documented under Class.getName():

If this class object represents a reference type that is not an array type then the binary name of the class is returned, as specified by the Java™ Language Specification, Second Edition.

If this class object represents a primitive type or void, then the name returned is a String equal to the Java language keyword corresponding to the primitive type or void.

If this class object represents a class of arrays, then the internal form of the name consists of the name of the element type preceded by one or more '[' characters representing the depth of the array nesting. The encoding of element type names is as follows:

Element Type        Encoding
boolean             Z
byte                B
char                C
class or interface  Lclassname;
double              D
float               F
int                 I
long                J
short               S 

这篇关于在java堆转储中这些奇怪的类名是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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