{"id":912,"date":"2026-06-17T15:45:52","date_gmt":"2026-06-17T15:45:52","guid":{"rendered":"https:\/\/boochlin.com\/?p=912"},"modified":"2026-06-17T15:47:16","modified_gmt":"2026-06-17T15:47:16","slug":"android-%e7%88%9b%e8%a3%9d%e7%bd%ae%e6%83%b3%e8%b7%91%e4%ba%ba%e8%87%89%e8%be%a8%e8%ad%986-gc-%e5%84%aa%e5%8c%96%e6%9c%80%e5%be%8c%e4%b8%80%e5%93%a9%e8%b7%af","status":"publish","type":"post","link":"https:\/\/boochlin.com\/?p=912","title":{"rendered":"Android \u721b\u88dd\u7f6e\u60f3\u8dd1\u4eba\u81c9\u8fa8\u8b586 &#8211; GC \u512a\u5316\u6700\u5f8c\u4e00\u54e9\u8def"},"content":{"rendered":"\n<p>\u5927\u90e8\u5206\u7684  App \u958b\u767c\u8005\u7e3d\u89ba\u5f97 new \u4e00\u500b\u7269\u4ef6\u662f\u514d\u8cbb\u7684\uff0c\u78ba\u5be6\u4e0d\u9700\u8981\u53bb\u8003\u616e new \u4e00\u500b\u7269\u4ef6\u5f8c\u6703\u600e\u9ebc\u6a23\uff0c\u76f4\u5230\u4ed6\u5011\u88ab\u6d3e\u53bb\u5beb\u721b\u88dd\u7f6e\u3002<\/p>\n\n\n\n<p>\u7576\u4f60\u5728\u4e00\u53f0\u53ea\u6709 2GB RAM\u3001CPU 1.3GHz \u7684\u7834\u677f\u5b50\u4e0a\uff0c\u88ab\u8981\u6c42\u540c\u6642\u8dd1\u6eff RGB\u3001\u7d05\u5916\u7dda\uff08IR\uff09\u8207 TOF \u6df1\u5ea6\u76f8\u6a5f\u4e09\u8def\u9ad8\u983b\u5f71\u50cf\u6d41\u6642&#8230;<\/p>\n\n\n\n<p>\u6574\u7406\u4e00\u4e0b\u6709\u54ea\u4e9b\u65b9\u6cd5\uff0e\u9664\u4e86\u5927\u898f\u6a21\u7684\u8abf\u6574android \u53c3\u6578\uff0c\u6709\u4e9b\u5c0f\u7d30\u7bc0\u53ef\u4ee5\u9ad8\u6548\u7684\u5e6b\u52a9 gc \u6548\u80fd<\/p>\n\n\n\n<p>\u53ef\u80fd\u6709\u6a5f\u6703\u53ef\u4ee5\u4fdd\u547d\uff0c\u7576\u7136\u662f\u5e0c\u671b\u4e0d\u8981\u518d\u5beb\u9019\u7a2e\u721b\u88dd\u7f6e<\/p>\n\n\n\n<p><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"user-content-\u512a\u5316\u4e00object-pool-\u5c31\u50cf\u7981\u6b62\u4f7f\u7528\u514d\u6d17\u9910\u5177\">\u53ef\u56de\u6536\u7684 Pool <\/h2>\n\n\n\n<p>\u5728 Android \u8655\u7406\u76f8\u6a5f\u4e32\u6d41\uff0c\u76f8\u6a5f\u6bcf\u79d2\u5410\u51fa\u4f86\u7684\u5f71\u50cf\u8cc7\u6599\u8ddf\u5c71\u4e00\u6a23\u5927\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u4f60\u6bcf\u4e00\u5f35\u5716\u90fd\u53bb&nbsp;<code>new<\/code>&nbsp;\u4e00\u500b\u65b0\u7a7a\u9593\uff08\u5c31\u50cf\u4f7f\u7528\u514d\u6d17\u9910\u5177\uff09\uff0c\u7528\u5b8c\u5c31\u4e1f\u7d66\u7cfb\u7d71\u56de\u6536\uff0c\u7cfb\u7d71\u5149\u662f\u300c\u8ddf\u5728\u5f8c\u9762\u64bf\u5783\u573e (GC)\u300d\u5c31\u6703\u5361\u5230\u61f7\u7591\u4eba\u751f\uff1a\u4e0a\u4e00\u79d2\u958b\u9580\u5f88\u9806\uff0c\u4e0b\u4e00\u79d2\u64bf\u500b\u5783\u573e\u5c31\u5361\u4e86 800ms\u3002\u6700\u5f8c\u7cfb\u7d71\u6703\u76f4\u63a5\u56e0\u70ba\u5783\u573e\u5806\u6eff (OOM) \u800c\u9583\u9000\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<p><strong>\u89e3\u6cd5\uff1a\u767c\u653e\u9435\u7897 (RecycleableBuffer)<\/strong><\/p>\n\n\n\n<p>\u6211\u5011\u5fb9\u5e95\u7981\u6b62\u4f7f\u7528\u514d\u6d17\u9910\u5177\uff0c\u624b\u523b\u4e86\u8a18\u61b6\u9ad4\u6c60\u3002 \u53ea\u767c\u7d66\u7a0b\u5f0f\u5e7e\u500b\u56fa\u5b9a\u7684\u9435\u7897\u3002\u88dd\u5b8c\u5f71\u50cf\u3001AI \u7b97\u5b8c\u4e4b\u5f8c\uff0c\u628a\u9435\u7897\u6d17\u4e7e\u6de8\uff08<code>.recycle()<\/code>\uff09\uff0c\u7e7c\u7e8c\u88dd\u4e0b\u4e00\u9813\u3002\u4e0d\u7522\u5783\u573e\uff0c\u7cfb\u7d71\u5c31\u6c38\u9060\u4e0d\u6703\u56e0\u70ba\u64bf\u5783\u573e\u800c\u5361\u9813\u3002<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"user-content-\u512a\u5316\u4e8c\u552f\u4e00\u7684\u59a5\u5354\u9632\u7bc4\u76f8\u6a5f\u5e95\u5c64\u7121\u60c5\u8986\u5beb\">\u5c0f\u5c0f\u7684\u4f8b\u5916\uff0c\u9001\u9032 tflite or \u5176\u4ed6 \u6a21\u578b\uff0c\u5e0c\u671b\u662f\u76e1\u53ef\u80fd\u4e7e\u6de8\u7684<\/h2>\n\n\n\n<p>\u96d6\u7136\u6211\u5011\u63d0\u5021\u4e0d\u7528\u514d\u6d17\u9910\u5177\uff0c\u4f46\u5982\u679c\u4f60\u770b\u7a0b\u5f0f\u78bc\uff0c\u6703\u767c\u73fe\u5c0d\u65bc\u76f8\u6a5f\u50b3\u4f86\u7684 RGB \u756b\u9762\uff0c\u6211\u5011\u5c45\u7136\u5077\u5077\u8907\u88fd\u4e86\u4e00\u4efd\uff08<code>bitmap.copy<\/code>\uff09\uff0c\u786c\u751f\u751f\u5403\u4e86\u4e00\u6b21\u6548\u80fd\u8667\u3002<\/p>\n\n\n\n<p>\u6253\u81c9\u4e86\u5427\uff1f\u70ba\u4ec0\u9ebc\u5728\u9019\u88e1\u7834\u529f\uff1f<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<p><strong>\u89e3\u6cd5\uff1a\u7269\u7406\u9694\u96e2<\/strong><\/p>\n\n\n\n<p>\u56e0\u70ba\u76f8\u6a5f\u786c\u9ad4\u662f\u500b\u7121\u60c5\u7684\u6a5f\u5668\u3002\u5982\u679c\u4f60\u4e0d\u628a\u756b\u9762\u8d95\u5feb\u62f7\u8c9d\u51fa\u4f86\uff0c\u7576 AI \u6162\u6162\u541e\u541e\u7b97\u5230\u4e00\u534a\u6642\uff0c\u76f8\u6a5f\u5e95\u5c64\u96a8\u6642\u6703\u628a\u300c\u4e0b\u4e00\u5e40\u300d\u7684\u756b\u9762\uff0c\u76f4\u63a5\u5012\u9032\u540c\u4e00\u500b\u7897\u88e1\u84cb\u6389\u3002<\/p>\n\n\n\n<p>\u4f60\u7684\u795e\u7d93\u7db2\u8def\u5c31\u6703\u5403\u5230\u4e00\u5f35\uff1a**\u300c\u4e0a\u534a\u622a\u662f\u524d\u4e00\u79d2\u7684\u4eba\u3001\u4e0b\u534a\u622a\u662f\u5f8c\u4e00\u79d2\u7684\u80cc\u666f\u300d**\u7684\u6495\u88c2\u7834\u5716\u3002 \u70ba\u4e86\u89e3\u6c7a\u9019\u500b\u554f\u984c\uff0c\u6211\u5011\u8a8d\u8f38\u3002\u6211\u5011\u8001\u8001\u5be6\u5be6\u82b1\u6548\u80fd\u628a\u756b\u9762\u62f7\u8c9d\u51fa\u4f86\uff0c\u53bb\u63db\u53d6\u300c\u9001\u9032 AI \u5634\u88e1\u7684\u8089\u7d55\u5c0d\u4e7e\u6de8\u300d\u3002<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"user-content-\u512a\u5316\u4e09\u6700\u7c97\u66b4\u7684\u5b89\u5168\u80cc\u58d3\u5c31\u50cf\u628a\u4f54\u4f4d\u7684\u5ba2\u4eba\u8e39\u51fa\u53bb\">\u6700\u7c97\u66b4\u7684\u5b89\u5168\u80cc\u58d3\uff0c\u5c31\u50cf\u300c\u628a\u4f54\u4f4d\u7684\u5ba2\u4eba\u8e39\u51fa\u53bb\u300d<\/h2>\n\n\n\n<p>\u76f8\u6a5f\u4e00\u79d2\u585e\u7d66\u4f60 30 \u5f35\u5716\uff0c\u4f46\u4f60\u90a3\u53ef\u60b2\u7684 CPU \u4e00\u79d2\u53ea\u80fd\u6d88\u5316 6 \u5f35\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u4f60\u8b93\u591a\u51fa\u4f86\u7684\u5716\u5728\u8a18\u61b6\u9ad4\u88e1\u9762\u6162\u6162\u6392\u968a\uff0c\u4e0d\u7528 10 \u79d2\u9418\uff0c\u6392\u968a\u7684\u4eba\u6f6e\u5c31\u6703\u628a\u6574\u53f0\u6a5f\u5668\u6490\u7206\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<p><strong>\u89e3\u6cd5\uff1a\u7121\u60c5\u7684 Drop-Oldest<\/strong><\/p>\n\n\n\n<p>\u6211\u5011\u4e0d\u4f9d\u8cf4\u4efb\u4f55\u512a\u96c5\u7684\u6846\u67b6\uff0c\u76f4\u63a5\u5728\u9580\u53e3\u53ea\u653e 3 \u5f35\u6905\u5b50\uff08<code>FD_QUEUE_MAX_SIZE = 3<\/code>\uff09\u3002 \u5982\u679c\u6905\u5b50\u5750\u6eff\u4e86\uff0cAI \u53c8\u9084\u6c92\u7b97\u5b8c\u600e\u9ebc\u8fa6\uff1f\u6211\u5011\u7684\u7a0b\u5f0f\u6703\u76f4\u63a5\u8d70\u904e\u53bb\uff0c<strong>\u628a\u5750\u6700\u4e45\u7684\u90a3\u500b\u4eba\u62d6\u51fa\u4f86\u8e39\u51fa\u53bb\uff08\u547c\u53eb recycle \u4e1f\u68c4\u820a\u5e40\uff09<\/strong>\uff0c\u8b93\u6700\u65b0\u9032\u4f86\u7684\u5ba2\u4eba\u5750\uff01<\/p>\n<\/blockquote>\n\n\n\n<p>\u9019\u5728\u624b\u6a5f App \u53eb\u300c\u5361\u9813\u6389\u5e40\u300d\uff0c\u5728\u5de5\u696d\u6a5f\u53f0\u53eb\u300c\u6975\u9650\u751f\u5b58\u300d\u3002\u5be7\u53ef\u6d41\u5931\u5ba2\u4eba\uff0c\u4e5f\u7d55\u5c0d\u4e0d\u8b93\u5e97\u88ab\u64e0\u7206\u3002\u800c\u4e14 AI \u7d55\u5c0d\u4e0d\u80fd\u53bb\u7b97\u300c\u904e\u671f\u7684\u820a\u756b\u9762\u300d\uff0c\u5426\u5247\u5927\u9580\u6253\u958b\u6642\uff0c\u4eba\u65e9\u5c31\u8d70\u904e\u53bb\u4e86\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"user-content-\u512a\u5316\u56db\u7d1a\u806f\u62d2\u7d55\u5c31\u50cf\u9580\u53e3\u7684\u60e1\u9738\u8b66\u885b\"><strong>\u6f0f\u6597\u5f0f\u6dd8\u6c70<\/strong><\/h2>\n\n\n\n<p>\u5982\u679c\u4f60\u9023\u8def\u908a\u98db\u904e\u53bb\u7684\u84bc\u8805\u3001\u6216\u662f\u8d70\u904e\u53bb\u7684\u80cc\u5f71\uff0c\u90fd\u8981\u7121\u8166\u555f\u52d5\u6700\u9802\u7d1a\u7684 AI \u53bb\u7b97\u4ed6\u9577\u5f97\u50cf\u8ab0\uff0c\u9019\u53f0\u7834\u6a5f\u5668\u7684 CPU \u6703 24 \u5c0f\u6642\u760b\u72c2\u6eff\u8f09\u3002\u7136\u5f8c\u904e\u71b1\u3001\u964d\u983b\uff0c\u6700\u5f8c\u96fb\u6c60\u81a8\u8139\u70b8\u88c2\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<p><strong>\u89e3\u6cd5\uff1a\u6f0f\u6597\u5f0f\u6dd8\u6c70<\/strong><\/p>\n\n\n\n<p>\u6211\u5011\u5728 Pipeline \u9580\u53e3\u8a2d\u4e86\u4e09\u9053\u60e1\u9738\u8b66\u885b\uff0c\u7d14\u7cb9\u70ba\u4e86\u64cb\u4e0b\u7121\u6548\u904b\u7b97\uff1a<\/p>\n\n\n\n<ol>\n<li><strong>\u7b2c\u4e00\u95dc\uff08\u81c9\u90e8\u5075\u6e2c\uff09\uff1a<\/strong>&nbsp;\u6c92\u770b\u5230\u4eba\u81c9\uff1f\u6efe\u3002<\/li>\n\n\n\n<li><strong>\u7b2c\u4e8c\u95dc\uff08\u6a21\u7cca\u6aa2\u67e5\uff09\uff1a<\/strong>&nbsp;\u81c9\u662f\u7cca\u7684\u3001\u4eba\u5728\u8dd1\uff1f\u6efe\u3002<\/li>\n\n\n\n<li><strong>\u7b2c\u4e09\u95dc\uff08\u6d3b\u9ad4\u9632\u507d\uff09\uff1a<\/strong>&nbsp;\u78ba\u5b9a\u662f\u500b\u7ad9\u5b9a\u4e0d\u52d5\u7684\u7acb\u9ad4\u6d3b\u4eba\uff0c\u624d\u51c6\u9032\u5927\u5ef3\u4eab\u53d7\u6700\u6602\u8cb4\u7684\u51b7\u6c23\uff08\u8dd1 CNN \u795e\u7d93\u7db2\u8def\uff09\u3002<\/li>\n<\/ol>\n<\/blockquote>\n\n\n\n<p>90% \u7684\u6642\u9593\u5927\u9580\u53e3\u662f\u6c92\u4eba\u7684\u3002\u9019\u5957\u60e1\u9738\u6a5f\u5236\u8b93 CPU \u5927\u90e8\u5206\u6642\u9593\u90fd\u5728\u7761\u89ba\uff0c\u6975\u5927\u5730\u5ef6\u9577\u4e86\u8a2d\u5099\u58fd\u547d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5927\u90e8\u5206\u7684  App \u958b\u767c\u8005\u7e3d\u89ba\u5f97 new \u4e00\u500b\u7269\u4ef6\u662f\u514d\u8cbb\u7684\uff0c\u78ba\u5be6\u4e0d\u9700\u8981\u53bb\u8003\u616e new \u4e00\u500b\u7269\u4ef6\u5f8c\u6703\u600e\u9ebc\u6a23\uff0c\u76f4\u5230\u4ed6\u5011\u88ab\u6d3e\u53bb\u5beb\u721b\u88dd\u7f6e\u3002<\/p>\n<p>\u7576\u4f60\u5728\u4e00\u53f0\u53ea\u6709 2GB RAM\u3001CPU 1.3GHz \u7684\u7834\u677f\u5b50\u4e0a\uff0c\u88ab\u8981\u6c42\u540c\u6642\u8dd1\u6eff RGB\u3001\u7d05\u5916\u7dda\uff08IR\uff09\u8207 TOF \u6df1\u5ea6\u76f8\u6a5f\u4e09\u8def\u9ad8\u983b\u5f71\u50cf\u6d41\u6642&#8230;<\/p>\n<p>\u6574\u7406\u4e00\u4e0b\u6709\u54ea\u4e9b\u65b9\u6cd5\uff0e\u9664\u4e86\u5927\u898f\u6a21\u7684\u8abf\u6574android \u53c3\u6578\uff0c\u6709\u4e9b\u5c0f\u7d30\u7bc0\u53ef\u4ee5\u9ad8\u6548\u7684\u5e6b\u52a9 gc \u6548\u80fd<\/p>\n<p>\u53ef\u80fd\u6709\u6a5f\u6703\u53ef\u4ee5\u4fdd\u547d\uff0c\u7576\u7136\u662f\u5e0c\u671b\u4e0d\u8981\u518d\u5beb\u9019\u7a2e\u721b\u88dd\u7f6e<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[50,3,80],"tags":[],"_links":{"self":[{"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/posts\/912"}],"collection":[{"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/boochlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=912"}],"version-history":[{"count":5,"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/posts\/912\/revisions"}],"predecessor-version":[{"id":917,"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/posts\/912\/revisions\/917"}],"wp:attachment":[{"href":"https:\/\/boochlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=912"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/boochlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=912"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/boochlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=912"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}