• When a java class is load by classloader, where the constant poll be put?


    Q:When a java class is load by classloader, where the constant poll be put?

    A:the "Non-Heap Memory". 

     Non-Heap (http://www.yourkit.com/docs/kb/sizes.jsp)

    Also, the JVM has memory other than the heap, referred to as non-heap memory. It is created at the JVM startup and stores per-class structures such as runtime constant pool, field and method data, and the code for methods and constructors, as well as interned Strings.

    Unfortunately, the only information JVM provides on non-heap memory is its overall size. No detailed information on non-heap memory content is available.

    The abnormal growth of non-heap memory size may indicate a potential problem, in this case you may check up the following:

    • If there are class loading issues such as leaked loaders. In this case, the problem may be solved with the help of Class loaders view.
    • If there are strings being massively interned. For detection of such problem, Object allocation recording may be used.

     Shallow and Retained size: http://www.yourkit.com/docs/java/help/sizes.jsp

    已编译类和原来的类源码区别在于,已编译类只包含类本身,内部类不会在已编译类中出现,而是生成另外一个已编译类文件;其二,已编译类中没有注释;其三,已编译类没有package和import部分。
    这里还得说说已编译类对Java类型的描述,对于原始类型由单个大写字母表示,Z代表boolean、C代表char、B代表byte、S代表short、I代表int、F代表float、J代表long、D代表double;而对类类型的描述使用内部名(internal name)外加前缀L和后面的分号共同表示来表示,所谓内部名就是带全包路径的表示法,例如String的内部名是java/lang/String;对于数组类型,使用单方括号加上数据元素类型的方式描述。最后对于方法的描述,用圆括号来表示,如果返回是void用V表示,具体参考下图。

  • 相关阅读:
    java 23种设计模式及具体例子 收藏有时间慢慢看
    java中的内存一般分成几部分?
    深入浅出Java垃圾回收机制
    HashMap、HashTable、LinkedHashMap和TreeMap用法和区别
    java 序列化与反序列化
    JAVA中int、String的类型相互转换
    java IO和NIO 的区别
    数据库设计
    服务器硬件优化
    系统配置优化
  • 原文地址:https://www.cnblogs.com/haobo/p/3865138.html
Copyright © 2020-2023  润新知