New posts
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
$ java -cp build Probe (JDK 25 default)
|
||||
got Unsafe instance
|
||||
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
|
||||
WARNING: sun.misc.Unsafe::allocateMemory has been called by Probe (file:<build>/c25/)
|
||||
WARNING: Please consider reporting this to the maintainers of class Probe
|
||||
WARNING: sun.misc.Unsafe::allocateMemory will be removed in a future release
|
||||
read back 42
|
||||
allocate/put/get/free all succeeded
|
||||
second use read 7
|
||||
|
||||
$ java --sun-misc-unsafe-memory-access=allow -cp build Probe
|
||||
got Unsafe instance
|
||||
read back 42
|
||||
allocate/put/get/free all succeeded
|
||||
second use read 7
|
||||
|
||||
$ java --sun-misc-unsafe-memory-access=warn -cp build Probe
|
||||
got Unsafe instance
|
||||
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
|
||||
WARNING: sun.misc.Unsafe::allocateMemory has been called by Probe (file:<build>/c25/)
|
||||
WARNING: Please consider reporting this to the maintainers of class Probe
|
||||
WARNING: sun.misc.Unsafe::allocateMemory will be removed in a future release
|
||||
read back 42
|
||||
allocate/put/get/free all succeeded
|
||||
second use read 7
|
||||
|
||||
$ java --sun-misc-unsafe-memory-access=debug -cp build Probe
|
||||
got Unsafe instance
|
||||
WARNING: sun.misc.Unsafe::allocateMemory called by Probe (file:<build>/c25/)
|
||||
at Probe.main(Probe.java:12)
|
||||
WARNING: sun.misc.Unsafe::putLong called by Probe (file:<build>/c25/)
|
||||
at Probe.main(Probe.java:13)
|
||||
WARNING: sun.misc.Unsafe::getLong called by Probe (file:<build>/c25/)
|
||||
at Probe.main(Probe.java:14)
|
||||
read back 42
|
||||
WARNING: sun.misc.Unsafe::freeMemory called by Probe (file:<build>/c25/)
|
||||
at Probe.main(Probe.java:15)
|
||||
allocate/put/get/free all succeeded
|
||||
WARNING: sun.misc.Unsafe::allocateMemory called by Probe (file:<build>/c25/)
|
||||
at Probe.main(Probe.java:21)
|
||||
WARNING: sun.misc.Unsafe::putLong called by Probe (file:<build>/c25/)
|
||||
at Probe.main(Probe.java:22)
|
||||
WARNING: sun.misc.Unsafe::getLong called by Probe (file:<build>/c25/)
|
||||
at Probe.main(Probe.java:23)
|
||||
second use read 7
|
||||
WARNING: sun.misc.Unsafe::freeMemory called by Probe (file:<build>/c25/)
|
||||
at Probe.main(Probe.java:24)
|
||||
|
||||
$ java --sun-misc-unsafe-memory-access=deny -cp build Probe
|
||||
got Unsafe instance
|
||||
FAILED: java.lang.UnsupportedOperationException: allocateMemory
|
||||
second use FAILED: java.lang.UnsupportedOperationException: allocateMemory
|
||||
|
||||
# the JVM also publishes the flag as a system property that libraries can read
|
||||
$ java tools/Prop.java (default)
|
||||
sun.misc.unsafe.memory.access=null
|
||||
$ java --sun-misc-unsafe-memory-access=allow tools/Prop.java
|
||||
sun.misc.unsafe.memory.access=allow
|
||||
$ java --sun-misc-unsafe-memory-access=warn tools/Prop.java
|
||||
sun.misc.unsafe.memory.access=warn
|
||||
$ java --sun-misc-unsafe-memory-access=debug tools/Prop.java
|
||||
sun.misc.unsafe.memory.access=debug
|
||||
$ java --sun-misc-unsafe-memory-access=deny tools/Prop.java
|
||||
sun.misc.unsafe.memory.access=deny
|
||||
Reference in New Issue
Block a user