JVM 崩溃时异常显示的奇怪路径
Strange path shown in exception when JVM crashes
运行之后的代码如
public static void main(String... args) throws Exception {
getUnsafe().getByte(0);
}
private static Unsafe getUnsafe() throws NoSuchFieldException, IllegalAccessException {
Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
theUnsafe.setAccessible(true);
return (Unsafe) theUnsafe.get(null);
}
导致 JVM 崩溃,然后查看记录的输出,在内部异常部分下显示了一些奇怪的路径:
thrown at [C:\re\workspace-2-build-windows-amd64-cygwin\jdk8u6007\hotspot\srÚÞ ©Ö_®?
thrown at [C:\re\workspace-2-build-windows-amd64-cygwin\jdk8u6007\hotspot\src\share\vm\prims\j
我的本地机器上肯定没有这些路径,一些谷歌搜索显示它们经常出现在这些故障转储中。我假设它们来自 JDK 最初编译的时间。
我的问题是 - 正确吗?为什么这些信息被烘焙到 JDK 中?纯粹为了以后调试?
is that correct?
我想是的。
And why is this information baked into the JDK? Purely for debugging later?
是的,原始路径存储在一些编译图像中,用于 C/C++ 分析核心转储。
避免这些崩溃的一种方法是使用包装 Unsafe 的库,并确保您只访问有效的内存区域。例如Chronicle-Bytes 为 64 位内存大小执行此操作,对二进制和文本数据进行线程安全访问。 (免责声明,我帮忙写的)
运行之后的代码如
public static void main(String... args) throws Exception {
getUnsafe().getByte(0);
}
private static Unsafe getUnsafe() throws NoSuchFieldException, IllegalAccessException {
Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
theUnsafe.setAccessible(true);
return (Unsafe) theUnsafe.get(null);
}
导致 JVM 崩溃,然后查看记录的输出,在内部异常部分下显示了一些奇怪的路径:
thrown at [C:\re\workspace-2-build-windows-amd64-cygwin\jdk8u6007\hotspot\srÚÞ ©Ö_®?
thrown at [C:\re\workspace-2-build-windows-amd64-cygwin\jdk8u6007\hotspot\src\share\vm\prims\j
我的本地机器上肯定没有这些路径,一些谷歌搜索显示它们经常出现在这些故障转储中。我假设它们来自 JDK 最初编译的时间。
我的问题是 - 正确吗?为什么这些信息被烘焙到 JDK 中?纯粹为了以后调试?
is that correct?
我想是的。
And why is this information baked into the JDK? Purely for debugging later?
是的,原始路径存储在一些编译图像中,用于 C/C++ 分析核心转储。
避免这些崩溃的一种方法是使用包装 Unsafe 的库,并确保您只访问有效的内存区域。例如Chronicle-Bytes 为 64 位内存大小执行此操作,对二进制和文本数据进行线程安全访问。 (免责声明,我帮忙写的)