﻿{"id":2675,"date":"2019-01-01T16:38:43","date_gmt":"2019-01-01T07:38:43","guid":{"rendered":"http:\/\/yucchi.jp\/blog\/?p=2675"},"modified":"2019-01-01T16:40:10","modified_gmt":"2019-01-01T07:40:10","slug":"softreference","status":"publish","type":"post","link":"http:\/\/yucchi.jp\/blog\/?p=2675","title":{"rendered":"SoftReference"},"content":{"rendered":"<p>\u3042\u3051\u307e\u3057\u3066\u304a\u3081\u3067\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002<\/p>\n<p>\u3068\u3046\u3068\u3046\u4eca\u5e74\u306e\uff15\u6708\u3067\u5e73\u6210\u304c\u7d42\u308f\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<p>\u65b0\u3057\u3044\u5143\u53f7\u304c\u307e\u3060\u767a\u8868\u3055\u308c\u3066\u306a\u3044\u306e\u3067\u4e00\u90e8\u306e\u4eba\u306f\u56f0\u3063\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u304c\u3069\u3046\u306b\u304b\u306a\u3089\u306a\u3044\u3082\u306e\u306a\u3093\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<p>\u3055\u3066\u3001\u3069\u3046\u306b\u3082\u306a\u3089\u306a\u3044\u3053\u3068\u3092\u3069\u3046\u304b\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u982d\u304c\u75db\u304f\u306a\u308b\u304b\u3089\u73fe\u5b9f\u9003\u907f\u306e\u305f\u3081\u306b Java \u3067\u904a\u3076\u3068\u3057\u3088\u3046\u3002<\/p>\n<p>SoftReference \u3063\u3066\u805e\u3044\u305f\u3053\u3068\u306f\u3042\u308b\u3051\u3069\u5b9f\u969b\u306b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u7d44\u3080\u4e0a\u3067\u4f7f\u3063\u305f\u8a18\u61b6\u304c\u306a\u3044\u306e\u3067\u3053\u308c\u3067\u904a\u3093\u3067\u307f\u3088\u3046\u3002<\/p>\n<p>java.base \u30e2\u30b8\u30e5\u30fc\u30eb\u306e java.lang.ref \u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u3042\u308b public class SoftReference&lt;T&gt; extends Reference&lt;T&gt; \u30af\u30e9\u30b9\u3067\u3059\u3002<\/p>\n<p>API \u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306b\u8a18\u3055\u308c\u3066\u307e\u3059\u3002<\/p>\n<p><font color=\"#666666\">\u30e1\u30e2\u30ea\u30fc\u8981\u6c42\u306b\u5fdc\u3058\u3066\u30ac\u30d9\u30fc\u30b8\u30fb\u30b3\u30ec\u30af\u30bf\u306e\u5224\u65ad\u3067\u30af\u30ea\u30a2\u3055\u308c\u308b\u30bd\u30d5\u30c8\u53c2\u7167\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3059\u3002 <\/font><\/p>\n<p><font color=\"#666666\">\u30bd\u30d5\u30c8\u53c2\u7167\u306f\u901a\u5e38\u3001\u30e1\u30e2\u30ea\u30fc\u30fb\u30bb\u30f3\u30b7\u30c6\u30a3\u30d6\u306a\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u5b9f\u88c5\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002 <\/font><\/p>\n<p><font color=\"#666666\">\u3042\u308b\u6642\u70b9\u3067\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u30bd\u30d5\u30c8\u5230\u9054\u53ef\u80fd\u3067\u3042\u308b\u3068\u3001\u30ac\u30d9\u30fc\u30b8\u30fb\u30b3\u30ec\u30af\u30bf\u304c\u5224\u65ad\u3057\u305f\u3068\u3057\u307e\u3059\u3002 <\/font><\/p>\n<p><font color=\"#666666\">\u305d\u306e\u6642\u70b9\u3067\u3001\u30ac\u30d9\u30fc\u30b8\u30fb\u30b3\u30ec\u30af\u30bf\u306f\u3001\u305d\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3078\u306e\u30bd\u30d5\u30c8\u53c2\u7167\u3059\u3079\u3066\u3068\u3001\u5f37\u53c2\u7167\u306e\u30c1\u30a7\u30fc\u30f3\u3092\u7d4c\u7531\u3057\u3066\u305d\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u5230\u9054\u3067\u304d\u308b\u3088\u3046\u306a\u3001\u30bd\u30d5\u30c8\u5230\u9054\u53ef\u80fd\u306a\u307b\u304b\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3078\u306e\u30bd\u30d5\u30c8\u53c2\u7167\u3059\u3079\u3066\u3092\u539f\u5b50\u7684\u306b\u30af\u30ea\u30a2\u3059\u308b\u3053\u3068\u3092\u9078\u629e\u3067\u304d\u307e\u3059\u3002 <\/font><\/p>\n<p><font color=\"#666666\">\u540c\u6642\u306b\u307e\u305f\u306f\u3042\u3068\u3067\u3001\u30ac\u30d9\u30fc\u30b8\u30fb\u30b3\u30ec\u30af\u30bf\u306f\u3001\u53c2\u7167\u30ad\u30e5\u30fc\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u308b\u305d\u308c\u3089\u306e\u65b0\u3057\u304f\u30af\u30ea\u30a2\u3055\u308c\u305f\u30bd\u30d5\u30c8\u53c2\u7167\u3092\u30ad\u30e5\u30fc\u306b\u5165\u308c\u307e\u3059\u3002 <\/font><\/p>\n<p><font color=\"#666666\"><font color=\"#ff0000\"><strong>\u30bd\u30d5\u30c8\u5230\u9054\u53ef\u80fd\u306a\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3078\u306e\u3059\u3079\u3066\u306e\u30bd\u30d5\u30c8\u53c2\u7167\u306f\u3001\u4eee\u60f3\u30de\u30b7\u30f3\u304cOutOfMemoryError\u3092\u30b9\u30ed\u30fc\u3059\u308b\u524d\u306b\u30af\u30ea\u30a2\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u4fdd\u8a3c\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/strong><\/font> <\/font><\/p>\n<p><font color=\"#666666\">\u305d\u3046\u3067\u306a\u3044\u5834\u5408\u3001\u30bd\u30d5\u30c8\u53c2\u7167\u304c\u30af\u30ea\u30a2\u3055\u308c\u308b\u6642\u70b9\u3001\u307e\u305f\u306f\u3055\u307e\u3056\u307e\u306a\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3078\u306e\u4e00\u9023\u306e\u30bd\u30d5\u30c8\u53c2\u7167\u304c\u30af\u30ea\u30a2\u3055\u308c\u308b\u9806\u5e8f\u306b\u5236\u7d04\u306f\u3042\u308a\u307e\u305b\u3093\u3002 <\/font><\/p>\n<p><font color=\"#666666\">\u305f\u3060\u3057\u3001\u4eee\u60f3\u30de\u30b7\u30f3\u306e\u5b9f\u88c5\u306f\u3001\u6700\u8fd1\u4f5c\u6210\u3055\u308c\u305f\u30bd\u30d5\u30c8\u53c2\u7167\u307e\u305f\u306f\u6700\u8fd1\u4f7f\u7528\u3055\u308c\u305f\u30bd\u30d5\u30c8\u53c2\u7167\u3092\u30af\u30ea\u30a2\u3057\u306a\u3044\u3053\u3068\u304c\u5968\u52b1\u3055\u308c\u307e\u3059\u3002 <\/font><\/p>\n<p><font color=\"#666666\">\u3053\u306e\u30af\u30e9\u30b9\u306e\u76f4\u63a5\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306f\u3001\u5358\u7d14\u306a\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u5b9f\u88c5\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002<\/font><\/p>\n<p><font color=\"#666666\">\u3053\u306e\u30af\u30e9\u30b9\u307e\u305f\u306f\u6d3e\u751f\u3057\u305f\u30b5\u30d6\u30af\u30e9\u30b9\u306f\u3001\u3088\u308a\u6d17\u7df4\u3055\u308c\u305f\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u5b9f\u88c5\u3059\u308b\u305f\u3081\u306b\u3001\u3082\u3063\u3068\u5927\u304d\u306a\u30c7\u30fc\u30bf\u69cb\u9020\u3067\u3082\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002 <\/font><\/p>\n<p><font color=\"#666666\">\u30bd\u30d5\u30c8\u53c2\u7167\u306e\u30ea\u30d5\u30a1\u30ec\u30f3\u30c8\u304c\u5f37\u5230\u9054\u53ef\u80fd\u3067\u3042\u308b\u304b\u304e\u308a\u3001\u3064\u307e\u308a\u5b9f\u969b\u306b\u4f7f\u7528\u3055\u308c\u3066\u3044\u308b\u304b\u304e\u308a\u3001\u30bd\u30d5\u30c8\u53c2\u7167\u306f\u30af\u30ea\u30a2\u3055\u308c\u307e\u305b\u3093\u3002 <\/font><\/p>\n<p><font color=\"#666666\">\u3053\u306e\u305f\u3081\u3001\u305f\u3068\u3048\u3070\u6d17\u7df4\u3055\u308c\u305f\u30ad\u30e3\u30c3\u30b7\u30e5\u306f\u3001\u30a8\u30f3\u30c8\u30ea\u3078\u306e\u5f37\u3044\u30ea\u30d5\u30a1\u30ec\u30f3\u30c8\u3092\u7dad\u6301\u3059\u308b\u3053\u3068\u3067\u3001\u3082\u3063\u3068\u3082\u65b0\u3057\u304f\u4f7f\u7528\u3055\u308c\u305f\u30a8\u30f3\u30c8\u30ea\u304c\u7834\u68c4\u3055\u308c\u308b\u3053\u3068\u3092\u9632\u304e\u3001\u307b\u304b\u306e\u30a8\u30f3\u30c8\u30ea\u306f\u30ac\u30d9\u30fc\u30b8\u30fb\u30b3\u30ec\u30af\u30bf\u306e\u5224\u65ad\u3067\u7834\u68c4\u3055\u308c\u308b\u3088\u3046\u306b\u3067\u304d\u307e\u3059\u3002 <\/font><\/p>\n<p>\u3064\u307e\u308a\u3001\u30ac\u30d9\u30fc\u30b8\u30fb\u30b3\u30ec\u30af\u30bf\u304c\u53c2\u7167\u306e\u4f7f\u7528\u983b\u5ea6\u3068\u30d2\u30fc\u30d7\u306e\u72b6\u614b\u3092\u307f\u3066\u53c2\u7167\u306e\u89e3\u653e\u3092\u52dd\u624b\u306b\u3084\u3063\u3066\u304f\u308c\u308b\u306e\u3067 OutOfMemoryError \u3067\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u6b62\u307e\u3063\u3066\u3057\u307e\u3046\u3053\u3068\u304c\u306a\u3044\u3002<\/p>\n<p>\u30ac\u30d9\u30fc\u30b8\u30fb\u30b3\u30ec\u30af\u30bf\u304c\u5fc5\u6b7b\u3067\u304c\u3093\u3070\u3063\u3066\u304f\u308c\u308b\uff01\u79c1\u306f\u611f\u8b1d\u3059\u308b\u305e\uff01<\/p>\n<p>\u3067\u3001\u3053\u306e SoftReference&lt;T&gt; \u30af\u30e9\u30b9\u306b\u306f\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u304c\uff12\u7a2e\u985e\u3042\u308a\u307e\u3059\u3002<\/p>\n<p><font color=\"#666666\">SoftReference\u200b(T referent)<\/font><\/p>\n<p><font color=\"#666666\">\u6307\u5b9a\u3055\u308c\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u53c2\u7167\u3059\u308b\u65b0\u3057\u3044\u30bd\u30d5\u30c8\u53c2\u7167\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u65b0\u3057\u3044\u53c2\u7167\u306f\u3001\u3069\u306e\u30ad\u30e5\u30fc\u306b\u3082\u767b\u9332\u3055\u308c\u307e\u305b\u3093\u3002<\/font><\/p>\n<p><font color=\"#666666\">\u30d1\u30e9\u30e1\u30fc\u30bf:referent &#8211; \u65b0\u3057\u3044\u30bd\u30d5\u30c8\u53c2\u7167\u304c\u53c2\u7167\u3059\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/font><\/p>\n<p><font color=\"#666666\">SoftReference\u200b(T referent, ReferenceQueue&lt;? super T&gt; q)<\/font><\/p>\n<p><font color=\"#666666\">\u6307\u5b9a\u3055\u308c\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u53c2\u7167\u3057\u3001\u6307\u5b9a\u3055\u308c\u305f\u30ad\u30e5\u30fc\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u308b\u65b0\u3057\u3044\u30bd\u30d5\u30c8\u53c2\u7167\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002 <\/font><\/p>\n<p><font color=\"#666666\">\u30d1\u30e9\u30e1\u30fc\u30bf:referent &#8211; \u65b0\u3057\u3044\u30bd\u30d5\u30c8\u53c2\u7167\u304c\u53c2\u7167\u3059\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8q &#8211; \u53c2\u7167\u304c\u767b\u9332\u3055\u308c\u308b\u30ad\u30e5\u30fc\u3002\u767b\u9332\u304c\u5fc5\u8981\u306a\u3044\u5834\u5408\u306fnull<\/font><\/p>\n<p>\u30e1\u30bd\u30c3\u30c9\u306f\u4e00\u3064\u3060\u3051\u3042\u308a\u307e\u3059\u3002<\/p>\n<p><font color=\"#666666\">public T get()<br \/><\/font><\/p>\n<p><font color=\"#666666\">\u53c2\u7167\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30ea\u30d5\u30a1\u30ec\u30f3\u30c8\u3092\u8fd4\u3057\u307e\u3059\u3002 \u30d7\u30ed\u30b0\u30e9\u30e0\u307e\u305f\u306f\u30ac\u30d9\u30fc\u30b8\u30fb\u30b3\u30ec\u30af\u30bf\u306b\u3088\u3063\u3066\u3001\u3053\u306e\u53c2\u7167\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u3059\u3067\u306b\u30af\u30ea\u30a2\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u3001\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306fnull\u3092\u8fd4\u3057\u307e\u3059\u3002 <\/font><\/p>\n<p><font color=\"#666666\">\u623b\u308a\u5024:\u3053\u306e\u53c2\u7167\u304c\u8868\u3059\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3002\u3053\u306e\u53c2\u7167\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u30af\u30ea\u30a2\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u306fnull<\/font><\/p>\n<p>\u3082\u306e\u51c4\u304f\u8cea\u7d20\u306a\u30af\u30e9\u30b9\u3067\u3059\u306d\u3002<\/p>\n<p>\u305d\u3046\u8a00\u3046\u3053\u3068\u3067\u3055\u3063\u305d\u304f\u304a\u8a66\u3057\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u7d44\u3093\u3067\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>&nbsp;<\/p>\n<pre title=\"SoftReference_G1GC.java\"><code>\r\npackage jp.yucchi.softreference_g1gc;\r\n\r\nimport java.lang.management.ManagementFactory;\r\nimport java.lang.ref.Reference;\r\nimport java.lang.ref.ReferenceQueue;\r\nimport java.lang.ref.SoftReference;\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\n\/**\r\n *\r\n * @author Yucchi\r\n *\/\r\npublic class SoftReference_G1GC {\r\n\r\n    private static final ReferenceQueue&lt;MemoryConsumer&gt; REFEREN_CEQUEU = new ReferenceQueue&lt;&gt;();\r\n\r\n    public static void main(String[] args) {\r\n\r\n        System.out.println(System.getProperty(\"os.name\") + \" \"\r\n                + System.getProperty(\"os.version\") + \" \" + System.getProperty(\"os.arch\"));\r\n        System.out.println(\"JDK \" + System.getProperty(\"java.version\") + System.lineSeparator());\r\n\r\n        List&lt;SoftReference&lt;MemoryConsumer&gt;&gt; list = new ArrayList&lt;&gt;();\r\n\r\n        for (int i = 0; i &lt; 1_000; i++) {\r\n            var memoryConsumer = new MemoryConsumer();\r\n            var softReference = new SoftReference&lt;&gt;(memoryConsumer, REFEREN_CEQUEU);\r\n            list.add(softReference);\r\n            checkStatus();\r\n        }\r\n\r\n    }\r\n\r\n    private static void checkStatus() {\r\n\r\n        var memoryBean = ManagementFactory.getMemoryMXBean();\r\n        var usage = memoryBean.getHeapMemoryUsage();\r\n        var usedMemory = usage.getUsed();\r\n        var gcMXBeans = ManagementFactory.getGarbageCollectorMXBeans();\r\n        var gcStatus = new StringBuilder();\r\n        gcMXBeans.forEach(e -&gt; {\r\n            gcStatus\r\n                    .append(e.getName())\r\n                    .append(\"   \")\r\n                    .append(\"GC Count: \")\r\n                    .append(e.getCollectionCount())\r\n                    .append(\"   \")\r\n                    .append(\"GCTime = \")\r\n                    .append(e.getCollectionTime())\r\n                    .append(\"     \");\r\n        });\r\n\r\n        System.out.print(\"UsedMemory: \" + usedMemory + \"   \");\r\n        System.out.println(gcStatus);\r\n\r\n        Reference&lt;?&gt; ref;\r\n        while ((ref = REFEREN_CEQUEU.poll()) != null) {\r\n            System.out.println(\"    --- POLL:\" + ref + \" ---\");\r\n        }\r\n\r\n    }\r\n\r\n    private static class MemoryConsumer {\r\n\r\n        private final byte[] buff;\r\n\r\n        MemoryConsumer() {\r\n            this.buff = new byte[100 * 1024 * 1024];\r\n        }\r\n\r\n    }\r\n\r\n}\r\n\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>\u7121\u99c4\u306b\u30e1\u30e2\u30ea\u30fc\u3092\u6d88\u8cbb\u3059\u308b\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30921000\u500b\u4f5c\u3063\u3066\u3044\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>\u666e\u901a\u306a\u3089 OutOfMemoryError \u3067\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u6b62\u307e\u3063\u3066\u3057\u307e\u3046\u306f\u305a\u3067\u3059\u304c SoftReference \u3092\u4f7f\u3063\u3066\u8ce2\u3044\u30ac\u30d9\u30fc\u30b8\u30fb\u30b3\u30ec\u30af\u30bf\u306e\u529b\u3067\u5b8c\u8d70\u3055\u305b\u3088\u3046\u3068\u3044\u3046\u3082\u306e\u3067\u3059\u3002<\/p>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u5b9f\u884c\u7d50\u679c\u306f\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>Windows 10 10.0 amd64<br \/>JDK 11.0.1<\/p>\n<p>UsedMemory: 113246208&nbsp;&nbsp; G1 Young Generation&nbsp;&nbsp; GC Count: 0&nbsp;&nbsp; GCTime = 0&nbsp;&nbsp;&nbsp;&nbsp; G1 Old Generation&nbsp;&nbsp; GC Count: 0&nbsp;&nbsp; GCTime = 0&nbsp;&nbsp;&nbsp;&nbsp; <br \/>UsedMemory: 222298112&nbsp;&nbsp; G1 Young Generation&nbsp;&nbsp; GC Count: 0&nbsp;&nbsp; GCTime = 0&nbsp;&nbsp;&nbsp;&nbsp; G1 Old Generation&nbsp;&nbsp; GC Count: 0&nbsp;&nbsp; GCTime = 0&nbsp;&nbsp;&nbsp;&nbsp; <br \/>UsedMemory: 331350016&nbsp;&nbsp; G1 Young Generation&nbsp;&nbsp; GC Count: 0&nbsp;&nbsp; GCTime = 0&nbsp;&nbsp;&nbsp;&nbsp; G1 Old Generation&nbsp;&nbsp; GC Count: 0&nbsp;&nbsp; GCTime = 0&nbsp;&nbsp;&nbsp;&nbsp; <br \/>UsedMemory: 440401920&nbsp;&nbsp; G1 Young Generation&nbsp;&nbsp; GC Count: 0&nbsp;&nbsp; GCTime = 0&nbsp;&nbsp;&nbsp;&nbsp; G1 Old Generation&nbsp;&nbsp; GC Count: 0&nbsp;&nbsp; GCTime = 0&nbsp;&nbsp;&nbsp;&nbsp; <br \/>UsedMemory: 546493104&nbsp;&nbsp; G1 Young Generation&nbsp;&nbsp; GC Count: 1&nbsp;&nbsp; GCTime = 3&nbsp;&nbsp;&nbsp;&nbsp; G1 Old Generation&nbsp;&nbsp; GC Count: 0&nbsp;&nbsp; GCTime = 0 <br \/>\u7565<br \/>UsedMemory: 110148312&nbsp;&nbsp; G1 Young Generation&nbsp;&nbsp; GC Count: 57&nbsp;&nbsp; GCTime = 109&nbsp;&nbsp;&nbsp;&nbsp; G1 Old Generation&nbsp;&nbsp; GC Count: 2&nbsp;&nbsp; GCTime = 1808&nbsp;&nbsp;&nbsp;&nbsp; <br \/>&nbsp;&nbsp;&nbsp; &#8212; POLL:java.lang.ref.SoftReference@59fa1d9b &#8212;<br \/>&nbsp;&nbsp;&nbsp; &#8212; POLL:java.lang.ref.SoftReference@28d25987 &#8212;<br \/>\u7565<br \/>&nbsp;&nbsp;&nbsp; &#8212; POLL:java.lang.ref.SoftReference@527740a2 &#8212;<br \/>&nbsp;&nbsp;&nbsp; &#8212; POLL:java.lang.ref.SoftReference@13a5fe33 &#8212;<br \/>UsedMemory: 219243560&nbsp;&nbsp; G1 Young Generation&nbsp;&nbsp; GC Count: 58&nbsp;&nbsp; GCTime = 110&nbsp;&nbsp;&nbsp;&nbsp; G1 Old Generation&nbsp;&nbsp; GC Count: 2&nbsp;&nbsp; GCTime = 1808&nbsp;&nbsp;&nbsp;&nbsp; <br \/>UsedMemory: 328295464&nbsp;&nbsp; G1 Young Generation&nbsp;&nbsp; GC Count: 58&nbsp;&nbsp; GCTime = 110&nbsp;&nbsp;&nbsp;&nbsp; G1 Old Generation&nbsp;&nbsp; GC Count: 2&nbsp;&nbsp; GCTime = 1808&nbsp; <br \/>\u7565<br \/>UsedMemory: 6762364184&nbsp;&nbsp; G1 Young Generation&nbsp;&nbsp; GC Count: 222&nbsp;&nbsp; GCTime = 332&nbsp;&nbsp;&nbsp;&nbsp; G1 Old Generation&nbsp;&nbsp; GC Count: 12&nbsp;&nbsp; GCTime = 8964&nbsp;&nbsp;&nbsp;&nbsp; <br \/>UsedMemory: 6871416088&nbsp;&nbsp; G1 Young Generation&nbsp;&nbsp; GC Count: 222&nbsp;&nbsp; GCTime = 332&nbsp;&nbsp;&nbsp;&nbsp; G1 Old Generation&nbsp;&nbsp; GC Count: 12&nbsp;&nbsp; GCTime = 8964 <\/p>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u7d42\u4e86\u3059\u308b\u307e\u3067\uff11\u5206\uff18\u79d2\u3082\u304b\u304b\u3063\u305f\u3002<\/p>\n<p><strong><font color=\"#9b00d3\">\u79c1\u306e\uff17\u5e74\u524d\u306e\u30d1\u30bd\u30b3\u30f3\u304c\u58ca\u308c\u305f\u306e\u304b\u3068\u601d\u3063\u3066\u3057\u307e\u3063\u305f\u3002(^_^;)<\/font><\/strong><\/p>\n<p>NetBeans \u306e\u30d7\u30ed\u30d5\u30a1\u30a4\u30e9\u3067\u3069\u3093\u306a\u304b\u3093\u3058\u306a\u306e\u304b\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"http:\/\/yucchi.jp\/blog\/wp-content\/uploads\/2019\/01\/1.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"1\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"1\" src=\"http:\/\/yucchi.jp\/blog\/wp-content\/uploads\/2019\/01\/1_thumb.png\" width=\"904\" height=\"435\"><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/yucchi.jp\/blog\/wp-content\/uploads\/2019\/01\/2.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"2\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"2\" src=\"http:\/\/yucchi.jp\/blog\/wp-content\/uploads\/2019\/01\/2_thumb.png\" width=\"904\" height=\"435\"><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/yucchi.jp\/blog\/wp-content\/uploads\/2019\/01\/3.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" title=\"3\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"3\" src=\"http:\/\/yucchi.jp\/blog\/wp-content\/uploads\/2019\/01\/3_thumb.png\" width=\"904\" height=\"446\"><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\u78ba\u304b\u306b OutOfMemoryError \u3067\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u6b62\u307e\u3089\u306a\u3044\u3088\u3046\u306b\u30ac\u30d9\u30fc\u30b8\u30fb\u30b3\u30ec\u30af\u30bf\u304c\u9811\u5f35\u3063\u3066\u3044\u308b\u3088\u3046\u3060\u3051\u3069GC\u6642\u9593\u9577\u304f\u306a\u3044\uff1f<\/p>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u5b9f\u884c\u7d50\u679c\u304b\u3089\u3082\u6c17\u306e\u305b\u3044\u304b GC \u306e\u56de\u6570\u3001\u7d2f\u7a4d\u6642\u9593\u304c\u9577\u3044\u3088\u3046\u306a\u6c17\u304c\u3059\u308b\u3002<\/p>\n<p>SoftReference \u3063\u3066\u3053\u3093\u306a\u3082\u306e\u306a\u306e\u304b\u306a\u3041\u30fb\u30fb\u30fb<\/p>\n<p>\u3042\u3063\u3001\u306a\u306b\u304b\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u554f\u984c\u304c\u3042\u308b\u306e\u304b\u3082\u3057\u308c\u306a\u3044\u3002<\/p>\n<p>\u3053\u308c\u306f WeakReference \u3067\u8a66\u3057\u3066\u6bd4\u8f03\u3057\u3066\u307f\u308b\u3057\u304b\u306a\u3044\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u6b21\u56de\u306b\u7d9a\u304f<\/p>\n<div id=\"scid:0767317B-992E-4b12-91E0-4F059A8CECA8:a01e4a5c-dc03-40f5-9067-2c6f74ce63bb\" class=\"wlWriterEditableSmartContent\" style=\"float: none; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px\">Hatena \u30bf\u30b0: <a href=\"http:\/\/b.hatena.ne.jp\/t\/Java\" rel=\"tag\">Java<\/a>,<a href=\"http:\/\/b.hatena.ne.jp\/t\/NetBeans\" rel=\"tag\">NetBeans<\/a><\/div>\n<div class='wp_social_bookmarking_light'>\n            <div class=\"wsbl_hatena\"><a href='\/\/b.hatena.ne.jp\/add?mode=confirm&url=http%3A%2F%2Fyucchi.jp%2Fblog%2F%3Fp%3D2675&title=SoftReference' title='\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0' rel=nofollow class='wp_social_bookmarking_light_a' target=_blank><img src='http:\/\/yucchi.jp\/blog\/wp-content\/plugins\/wp-social-bookmarking-light\/public\/images\/hatena.gif' alt='\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0' title='\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0' width='16' height='12' class='wp_social_bookmarking_light_img' \/><\/a><\/div>\n            <div class=\"wsbl_facebook\"><a href='http:\/\/www.facebook.com\/share.php?u=http%3A%2F%2Fyucchi.jp%2Fblog%2F%3Fp%3D2675&t=SoftReference' title='Facebook \u306b\u30b7\u30a7\u30a2' rel=nofollow class='wp_social_bookmarking_light_a' target=_blank><img src='http:\/\/yucchi.jp\/blog\/wp-content\/plugins\/wp-social-bookmarking-light\/public\/images\/facebook.png' alt='Facebook \u306b\u30b7\u30a7\u30a2' title='Facebook \u306b\u30b7\u30a7\u30a2' width='16' height='16' class='wp_social_bookmarking_light_img' \/><\/a><\/div>\n            <div class=\"wsbl_google_plus_one\"><g:plusone size=\"medium\" annotation=\"none\" href=\"http:\/\/yucchi.jp\/blog\/?p=2675\" ><\/g:plusone><\/div>\n            <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"http:\/\/yucchi.jp\/blog\/?p=2675\" data-text=\"SoftReference\" data-lang=\"ja\">Tweet<\/a><\/div>\n    <\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>\u3042\u3051\u307e\u3057\u3066\u304a\u3081\u3067\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002 \u3068\u3046\u3068\u3046\u4eca\u5e74\u306e\uff15\u6708\u3067\u5e73\u6210\u304c\u7d42\u308f\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002 \u65b0\u3057\u3044\u5143\u53f7\u304c\u307e\u3060\u767a\u8868\u3055\u308c\u3066\u306a\u3044\u306e\u3067\u4e00\u90e8\u306e\u4eba\u306f\u56f0\u3063\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u304c\u3069\u3046\u306b\u304b\u306a\u3089\u306a\u3044\u3082\u306e\u306a\u3093\u3067\u3057\u3087\u3046\u304b\uff1f \u3055\u3066\u3001\u3069\u3046\u306b\u3082\u306a\u3089\u306a\u3044\u3053\u3068\u3092\u3069\u3046\u304b\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u982d\u304c\u75db\u304f\u306a\u308b\u304b\u3089\u73fe\u5b9f\u9003\u907f\u306e\u305f\u3081\u306b Java \u3067\u904a\u3076\u3068\u3057\u3088\u3046\u3002 SoftReference \u3063\u3066\u805e\u3044\u305f\u3053\u3068\u306f\u3042\u308b\u3051\u3069\u5b9f\u969b\u306b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u7d44\u3080\u4e0a\u3067\u4f7f\u3063\u305f\u8a18\u61b6\u304c\u306a\u3044\u306e\u3067\u3053\u308c\u3067\u904a\u3093\u3067\u307f\u3088\u3046\u3002 java.base \u30e2\u30b8\u30e5\u30fc\u30eb\u306e java.lang.ref \u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u3042\u308b public class SoftReference&lt;T&gt; extends Reference\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4],"tags":[17,19],"class_list":["post-2675","post","type-post","status-publish","format-standard","hentry","category-java","category-netbeans","tag-java","tag-netbeans"],"_links":{"self":[{"href":"http:\/\/yucchi.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2675","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/yucchi.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/yucchi.jp\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/yucchi.jp\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/yucchi.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2675"}],"version-history":[{"count":1,"href":"http:\/\/yucchi.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2675\/revisions"}],"predecessor-version":[{"id":2676,"href":"http:\/\/yucchi.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2675\/revisions\/2676"}],"wp:attachment":[{"href":"http:\/\/yucchi.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/yucchi.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2675"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/yucchi.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}