java 对象共享,什么是共享对象文件?

When run the jvm in verbose mode it shows files are loading from shared object file as shown below

[Loaded java.lang.Object from shared objects file]

[Loaded java.io.Serializable from shared objects file]

[Loaded java.lang.Comparable from shared objects file]

[Loaded java.lang.CharSequence from shared objects file]

What is this shared objects files? I thought these are files in rt.jar and it's getting loaded from there; but rt.jar is getting opened in long way down

[Loaded java.security.BasicPermissionCollection from shared objects file]

[Opened C:\Program Files\Java\jre6\lib\rt.jar]

[Loaded sun.misc.JavaSecurityProtectionDomainAccess from C:\Program Files\Java\jre6\lib\rt.jar]

[Loaded java.security.ProtectionDomain$2 from C:\Program Files\Java\jre6\lib\rt.jar]

any way after extracting the rt.jar i found it has all the classes which were loaded from shared object file.

解决方案

This is Class Data Sharing. When running the Sun/Oracle Client HotSpot and sharing enable (either -Xshare:auto which is the default, or -Xshare:on), the classes.jsa file is memory mapped. This file contains a number of classes (listed in the classlist file) in internal representation suitable for the exact configuration of the machine running it. The idea is that the classes can be loaded quickly, getting the the JVM up faster. Soon enough a class not covered will be hit, and rt.jar will need to be opened and classes loaded conventionally as required.

Reference:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值