1 /* |
1 /* |
2 * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved. |
|
3 * Copyright (c) 2019, Azul Systems, Inc. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
5 * |
5 * This code is free software; you can redistribute it and/or modify it |
6 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
8 * published by the Free Software Foundation. Oracle designates this |
637 * @since 1.4 |
638 * @since 1.4 |
638 */ |
639 */ |
639 public native long maxMemory(); |
640 public native long maxMemory(); |
640 |
641 |
641 /** |
642 /** |
642 * Runs the garbage collector. |
643 * Runs the garbage collector in the Java Virtual Machine. |
643 * Calling this method suggests that the Java virtual machine expend |
644 * <p> |
644 * effort toward recycling unused objects in order to make the memory |
645 * Calling this method suggests that the Java Virtual Machine |
645 * they currently occupy available for quick reuse. When control |
646 * expend effort toward recycling unused objects in order to |
646 * returns from the method call, the virtual machine has made |
647 * make the memory they currently occupy available for reuse |
647 * its best effort to recycle all discarded objects. |
648 * by the Java Virtual Machine. |
|
649 * When control returns from the method call, the Java Virtual Machine |
|
650 * has made a best effort to reclaim space from all unused objects. |
|
651 * There is no guarantee that this effort will recycle any particular |
|
652 * number of unused objects, reclaim any particular amount of space, or |
|
653 * complete at any particular time, if at all, before the method returns or ever. |
648 * <p> |
654 * <p> |
649 * The name {@code gc} stands for "garbage |
655 * The name {@code gc} stands for "garbage |
650 * collector". The virtual machine performs this recycling |
656 * collector". The Java Virtual Machine performs this recycling |
651 * process automatically as needed, in a separate thread, even if the |
657 * process automatically as needed, in a separate thread, even if the |
652 * {@code gc} method is not invoked explicitly. |
658 * {@code gc} method is not invoked explicitly. |
653 * <p> |
659 * <p> |
654 * The method {@link System#gc()} is the conventional and convenient |
660 * The method {@link System#gc()} is the conventional and convenient |
655 * means of invoking this method. |
661 * means of invoking this method. |
677 public void runFinalization() { |
683 public void runFinalization() { |
678 SharedSecrets.getJavaLangRefAccess().runFinalization(); |
684 SharedSecrets.getJavaLangRefAccess().runFinalization(); |
679 } |
685 } |
680 |
686 |
681 /** |
687 /** |
682 * Not implemented, does nothing. |
|
683 * |
|
684 * @deprecated |
|
685 * This method was intended to control instruction tracing. |
|
686 * It has been superseded by JVM-specific tracing mechanisms. |
|
687 * This method is subject to removal in a future version of Java SE. |
|
688 * |
|
689 * @param on ignored |
|
690 */ |
|
691 @Deprecated(since="9", forRemoval=true) |
|
692 public void traceInstructions(boolean on) { } |
|
693 |
|
694 /** |
|
695 * Not implemented, does nothing. |
|
696 * |
|
697 * @deprecated |
|
698 * This method was intended to control method call tracing. |
|
699 * It has been superseded by JVM-specific tracing mechanisms. |
|
700 * This method is subject to removal in a future version of Java SE. |
|
701 * |
|
702 * @param on ignored |
|
703 */ |
|
704 @Deprecated(since="9", forRemoval=true) |
|
705 public void traceMethodCalls(boolean on) { } |
|
706 |
|
707 /** |
|
708 * Loads the native library specified by the filename argument. The filename |
688 * Loads the native library specified by the filename argument. The filename |
709 * argument must be an absolute path name. |
689 * argument must be an absolute path name. |
710 * (for example |
690 * (for example |
711 * {@code Runtime.getRuntime().load("/home/avh/lib/libX11.so");}). |
691 * {@code Runtime.getRuntime().load("/home/avh/lib/libX11.so");}). |
712 * |
692 * |
751 @CallerSensitive |
731 @CallerSensitive |
752 public void load(String filename) { |
732 public void load(String filename) { |
753 load0(Reflection.getCallerClass(), filename); |
733 load0(Reflection.getCallerClass(), filename); |
754 } |
734 } |
755 |
735 |
756 synchronized void load0(Class<?> fromClass, String filename) { |
736 void load0(Class<?> fromClass, String filename) { |
757 SecurityManager security = System.getSecurityManager(); |
737 SecurityManager security = System.getSecurityManager(); |
758 if (security != null) { |
738 if (security != null) { |
759 security.checkLink(filename); |
739 security.checkLink(filename); |
760 } |
740 } |
761 if (!(new File(filename).isAbsolute())) { |
741 if (!(new File(filename).isAbsolute())) { |
813 @CallerSensitive |
793 @CallerSensitive |
814 public void loadLibrary(String libname) { |
794 public void loadLibrary(String libname) { |
815 loadLibrary0(Reflection.getCallerClass(), libname); |
795 loadLibrary0(Reflection.getCallerClass(), libname); |
816 } |
796 } |
817 |
797 |
818 synchronized void loadLibrary0(Class<?> fromClass, String libname) { |
798 void loadLibrary0(Class<?> fromClass, String libname) { |
819 SecurityManager security = System.getSecurityManager(); |
799 SecurityManager security = System.getSecurityManager(); |
820 if (security != null) { |
800 if (security != null) { |
821 security.checkLink(libname); |
801 security.checkLink(libname); |
822 } |
802 } |
823 if (libname.indexOf((int)File.separatorChar) != -1) { |
803 if (libname.indexOf((int)File.separatorChar) != -1) { |
824 throw new UnsatisfiedLinkError( |
804 throw new UnsatisfiedLinkError( |
825 "Directory separator should not appear in library name: " + libname); |
805 "Directory separator should not appear in library name: " + libname); |
826 } |
806 } |
827 ClassLoader.loadLibrary(fromClass, libname, false); |
807 ClassLoader.loadLibrary(fromClass, libname, false); |
828 } |
808 } |
829 |
809 |
830 /** |
810 /** |