Last active
September 29, 2020 08:55
-
-
Save usmansaleem/eec7ddbf69d6fef6ce61714351c03c84 to your computer and use it in GitHub Desktop.
Forceful crash of JVM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void crash() { | |
try { | |
final Field f = Unsafe.class.getDeclaredField("theUnsafe"); | |
f.setAccessible(true); | |
final Unsafe unsafe = (Unsafe) f.get(null); | |
unsafe.putAddress(0, 0); | |
} catch (final NoSuchFieldException | IllegalAccessException e) { | |
throw new RuntimeException(e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment