Exception 0xC0000005 from JNI_CreateJavaVM (jvm.dll)

后端 未结 2 937
暗喜
暗喜 2020-11-27 07:27

I am initializing the Java VM using the following C++ code. JNI_CreateJavaVM throws a 0xC0000005 exception but succeeds none the less if I ignore i

相关标签:
2条回答
  • 2020-11-27 08:17

    JVM actively uses OS signals (or exceptions in Windows terminology) for its own purposes:

    • for implicit null pointer checks and stack overflow checks;
    • for safepoint polling;
    • for remote memory barriers;
    • etc.

    SEGV (or exception 0xC0000005) is also generated intentionally on JVM startup to verify certain CPU/OS features. Some OSes or hypervisors had a bug that AVX registers are not restored after signal processing. Therefore, JVM needs to check whether this is the case (the source). So it generates an exception by writing to zero address and then handles it.

    This is what happens in your case. And yes, it is normal.

    0 讨论(0)
  • 2020-11-27 08:20

    This is normal, like @apangin said. If you want to switch all 0xC0000005 exceptions off in VisualStudio (2017), you can do that:

    1. Exception Settings - Ctrl+Alt+E
    2. Remove tick from: "0xc0000005 Access violation" under Win32 Exceptions
    0 讨论(0)
提交回复
热议问题