{"id":95,"date":"2026-09-01T01:24:25","date_gmt":"2026-08-31T17:24:25","guid":{"rendered":"https:\/\/www.ziliaochi.cn\/index.php\/2026\/09\/01\/interview-mobile-startup-memory\/"},"modified":"2026-09-02T00:41:09","modified_gmt":"2026-09-01T16:41:09","slug":"interview-mobile-startup-memory","status":"publish","type":"post","link":"https:\/\/www.ziliaochi.cn\/index.php\/2026\/09\/01\/interview-mobile-startup-memory\/","title":{"rendered":"\u79fb\u52a8\u7aef\u9762\u8bd5\u9ad8\u9891\uff1a\u542f\u52a8\u6d41\u7a0b\u3001\u5185\u5b58\u7ba1\u7406\u4e0e ANR\/OOM \u6392\u67e5"},"content":{"rendered":"<div style=\"font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",\"PingFang SC\",\"Hiragino Sans GB\",\"Microsoft YaHei\",sans-serif;font-size:16.5px;line-height:1.9;color:#35435c;letter-spacing:.2px\">\n<div style=\"background:linear-gradient(135deg,#f5f9ff,#eef5ff);border:1px solid #dce8f8;border-left:4px solid #7c6cf0;border-radius:12px;padding:16px 20px;margin:0 0 24px;font-size:14.5px;color:#3d5570;line-height:2\"><span style=\"display:inline-block;background:#7c6cf0;color:#fff;font-size:12.5px;font-weight:700;padding:3px 10px;border-radius:6px;margin-right:12px;letter-spacing:1px;vertical-align:1px\">\u5173\u952e\u8bcd<\/span>\u51b7\u542f\u52a8\u3001Zygote\u3001\u5185\u5b58\u6cc4\u6f0f\u3001ANR\u3001OOM\u3001\u5361\u987f\u6392\u67e5\u3001\u79fb\u52a8\u7aef\u9762\u8bd5<\/div>\n<div style=\"background:#fafbfd;border:1px solid #e8edf5;border-radius:12px;padding:18px 22px;margin:0 0 30px\">\n<div style=\"font-size:13.5px;font-weight:700;color:#8a99ae;letter-spacing:2px;margin-bottom:12px\">\u76ee\u5f55<\/div>\n<ol style=\"margin:0;padding-left:20px\">\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-1\" style=\"color:#42546e;text-decoration:none;border:none\">\u4e00\u3001\u542f\u52a8\u6d41\u7a0b\uff1a\u4e24\u5f20\u6d41\u7a0b\u56fe<\/a><\/li>\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-2\" style=\"color:#42546e;text-decoration:none;border:none\">\u4e8c\u3001\u5185\u5b58\u7ba1\u7406\uff1a\u5fc5\u8003\u7684\u6838\u5fc3\u673a\u5236<\/a><\/li>\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-3\" style=\"color:#42546e;text-decoration:none;border:none\">\u4e09\u3001ANR \u4e0e OOM\uff1a\u7ebf\u4e0a\u95ee\u9898\u6392\u67e5<\/a><\/li>\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-4\" style=\"color:#42546e;text-decoration:none;border:none\">\u56db\u3001\u5361\u987f\u6392\u67e5\u7684\u901a\u7528\u65b9\u6cd5\u8bba<\/a><\/li>\n<li style=\"margin:8px 0;font-size:15px;line-height:1.6\"><a href=\"#sec-5\" style=\"color:#42546e;text-decoration:none;border:none\">\u4e94\u3001\u5c0f\u7ed3<\/a><\/li>\n<\/ol>\n<\/div>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\"><span style=\"font-size:17px;color:#1e2f47\">\u79fb\u52a8\u7aef\u9762\u8bd5\u6709\u4e24\u7c7b\u95ee\u9898\u6700\u80fd\u533a\u5206\u6c34\u5e73\uff1a\u4e00\u7c7b\u662f<strong style=\"color:#0f1c2e;font-weight:600\">\u80fd\u4e0d\u80fd\u8bb2\u6e05\u7cfb\u7edf\u542f\u52a8\u7684\u5b8c\u6574\u94fe\u8def<\/strong>\uff08\u8bf4\u660e\u4f60\u7406\u89e3\u5e73\u53f0\uff09\uff0c\u53e6\u4e00\u7c7b\u662f<strong style=\"color:#0f1c2e;font-weight:600\">\u9047\u5230\u7ebf\u4e0a\u5d29\u6e83\/\u5361\u6b7b\u80fd\u5426\u7ed9\u51fa\u6392\u67e5\u8def\u5f84<\/strong>\uff08\u8bf4\u660e\u4f60\u771f\u7684\u505a\u8fc7\u9879\u76ee\uff09\u3002<\/p>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u672c\u6587\u628a\u8fd9\u4e24\u5757\u7684\u9ad8\u9891\u771f\u9898\u6574\u7406\u6210\u53ef\u80cc\u8bf5\u3001\u53ef\u5ef6\u4f38\u7684\u7b54\u9898\u6846\u67b6\u3002<\/p>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #7c6cf0;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-1\">\u4e00\u3001\u542f\u52a8\u6d41\u7a0b\uff1a\u4e24\u5f20\u6d41\u7a0b\u56fe<\/h2>\n<figure style=\"margin:30px 0;text-align:center\"><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"900\" src=\"https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/interview-mobile-startup-memory-fig-1.png\" alt=\"Android \u51b7\u542f\u52a8\u94fe\u8def\" class=\"wp-image-160\" style=\"max-width:100%;height:auto;border-radius:12px;border:1px solid #e6ecf4;box-shadow:0 8px 24px rgba(15,30,60,.07)\" srcset=\"https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/interview-mobile-startup-memory-fig-1.png 1200w, https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/interview-mobile-startup-memory-fig-1-300x225.png 300w, https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/interview-mobile-startup-memory-fig-1-1024x768.png 1024w, https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/interview-mobile-startup-memory-fig-1-768x576.png 768w, https:\/\/www.ziliaochi.cn\/wp-content\/uploads\/2026\/09\/interview-mobile-startup-memory-fig-1-800x600.png 800w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><figcaption style=\"margin-top:12px;font-size:13.5px;color:#7b8aa0;text-align:center;line-height:1.75\">Android \u51b7\u542f\u52a8\u94fe\u8def\uff1aAMS \u2192 Zygote fork \u2192 Application \u2192 Activity \u2192 \u9996\u5e27\u4e0a\u5c4f<\/figcaption><\/figure>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #7c6cf040\">Android \u542f\u52a8\u94fe\u8def<\/h3>\n<ol style=\"padding-left:26px;margin:16px 0\">\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u70b9\u51fb\u56fe\u6807<\/strong> \u2192 Launcher \u901a\u8fc7 Binder \u901a\u77e5 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">ActivityManagerService<\/code>\uff08AMS\uff09\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">AMS \u68c0\u67e5\u76ee\u6807\u8fdb\u7a0b\u662f\u5426\u5b58\u5728\uff0c\u4e0d\u5b58\u5728\u5219\u901a\u8fc7 <strong style=\"color:#0f1c2e;font-weight:600\">Zygote<\/strong> fork \u51fa\u65b0\u8fdb\u7a0b\uff08Zygote \u9884\u52a0\u8f7d\u4e86\u6846\u67b6\u7c7b\u4e0e\u8d44\u6e90\uff0c\u8fd9\u662f fork \u5feb\u7684\u539f\u56e0\uff09\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">\u65b0\u8fdb\u7a0b\u521b\u5efa <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">ActivityThread<\/code>\uff0c\u6267\u884c <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">main()<\/code>\uff0c\u521d\u59cb\u5316 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Looper<\/code> \u4e0e\u4e3b\u7ebf\u7a0b\u6d88\u606f\u5faa\u73af\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">AMS \u901a\u77e5\u8fdb\u7a0b\u521b\u5efa <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Application<\/code>\uff0c\u56de\u8c03 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">onCreate()<\/code>\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">\u542f\u52a8\u9996\u5c4f <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">Activity<\/code>\uff1a\u4f9d\u6b21\u56de\u8c03 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">onCreate \u2192 onStart \u2192 onResume<\/code>\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">View \u6811\u5b8c\u6210\u6d4b\u91cf\u3001\u5e03\u5c40\u3001\u7ed8\u5236\u540e\uff0c<strong style=\"color:#0f1c2e;font-weight:600\">\u9996\u5e27\u4e0a\u5c4f<\/strong>\uff0c\u51b7\u542f\u52a8\u7ed3\u675f\u3002<\/li>\n<\/ol>\n<blockquote style=\"margin:24px 0;padding:16px 22px;background:#f7fafd;border-left:4px solid #7c6cf0;border-radius:0 10px 10px 0;color:#4a5b73;font-size:15.6px;line-height:1.88\">\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u8ffd\u95ee\uff1a<\/strong>&#8220;\u4e3a\u4ec0\u4e48\u8981\u6709 Zygote\uff1f&#8221;<br \/>\n\u56e0\u4e3a fork \u65f6\u5b50\u8fdb\u7a0b<strong style=\"color:#0f1c2e;font-weight:600\">\u7ee7\u627f\u7236\u8fdb\u7a0b\u7684\u5185\u5b58<\/strong>\u3002Zygote \u9884\u52a0\u8f7d\u4e86\u7cfb\u7edf\u6846\u67b6\u7c7b\u4e0e\u5e38\u7528\u8d44\u6e90\uff0cfork \u51fa\u7684\u5e94\u7528\u8fdb\u7a0b\u76f4\u63a5\u5171\u4eab\u8fd9\u4e9b\u5185\u5bb9\uff08\u5199\u65f6\u590d\u5236\uff09\uff0c\u7701\u53bb\u91cd\u590d\u52a0\u8f7d\u7684\u65f6\u95f4\u4e0e\u5185\u5b58\u3002\u8fd9\u662f Android \u542f\u52a8\u4f18\u5316\u7684\u57fa\u7840\u8bbe\u8ba1\u3002<\/p>\n<\/blockquote>\n<h3 style=\"font-size:18.5px;line-height:1.55;font-weight:700;color:#18283e;margin:30px 0 12px;padding-left:12px;border-left:3px solid #7c6cf040\">iOS \u542f\u52a8\u94fe\u8def<\/h3>\n<ol style=\"padding-left:26px;margin:16px 0\">\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">exec()<\/strong> \u52a0\u8f7d Mach-O \u53ef\u6267\u884c\u6587\u4ef6\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">dyld<\/strong> \u52a0\u8f7d\u52a8\u6001\u5e93\uff08dylib\uff09\uff0c\u5b8c\u6210\u7b26\u53f7\u7ed1\u5b9a\u4e0e rebase\/bind\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">\u8fd0\u884c Objective-C\/Swift \u8fd0\u884c\u65f6\u521d\u59cb\u5316\uff08\u6ce8\u518c\u7c7b\u3001\u5206\u7c7b\u3001+load\uff09\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">\u8c03\u7528 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">main()<\/code> \u2192 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">UIApplicationMain<\/code>\uff0c\u5efa\u7acb\u4e3b RunLoop\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">AppDelegate \u56de\u8c03\u7cfb\u5217\u65b9\u6cd5\uff0c\u6700\u7ec8\u6e32\u67d3\u9996\u5c4f\u3002<\/li>\n<\/ol>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">Q\uff1a\u51b7\u542f\u52a8\u3001\u6e29\u542f\u52a8\u3001\u70ed\u542f\u52a8\u7684\u533a\u522b\uff1f<\/strong><br \/>\n\u51b7\u542f\u52a8\u662f<strong style=\"color:#0f1c2e;font-weight:600\">\u8fdb\u7a0b\u5b8c\u5168\u4e0d\u5b58\u5728<\/strong>\uff0c\u9700\u8981\u5b8c\u6574\u521b\u5efa\uff1b\u6e29\u542f\u52a8\u662f\u8fdb\u7a0b\u5b58\u5728\u4f46 Activity \u9700\u91cd\u5efa\uff1b\u70ed\u542f\u52a8\u662f\u5e94\u7528\u5df2\u5728\u540e\u53f0\uff0c\u76f4\u63a5\u5207\u56de\u524d\u53f0\u3002<strong style=\"color:#0f1c2e;font-weight:600\">\u4f18\u5316\u76ee\u6807\u901a\u5e38\u6307\u51b7\u542f\u52a8<\/strong>\u3002<\/p>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #7c6cf0;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-2\">\u4e8c\u3001\u5185\u5b58\u7ba1\u7406\uff1a\u5fc5\u8003\u7684\u6838\u5fc3\u673a\u5236<\/h2>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">Q\uff1aAndroid \u4e0e iOS \u7684\u5185\u5b58\u7ba1\u7406\u673a\u5236\u6709\u4f55\u4e0d\u540c\uff1f<\/strong><\/p>\n<figure class=\"wp-block-table\">\n<table style=\"width:100%;border-collapse:collapse;margin:24px 0;font-size:15px;border:1px solid #e3eaf3;border-radius:10px;overflow:hidden\">\n<thead>\n<tr>\n<th style=\"background:#f2f6fb;color:#12233a;font-weight:700;padding:12px 14px;text-align:left;border-bottom:1px solid #e3eaf3;font-size:15px\">\u7ef4\u5ea6<\/th>\n<th style=\"background:#f2f6fb;color:#12233a;font-weight:700;padding:12px 14px;text-align:left;border-bottom:1px solid #e3eaf3;font-size:15px\">Android\uff08ART\uff09<\/th>\n<th style=\"background:#f2f6fb;color:#12233a;font-weight:700;padding:12px 14px;text-align:left;border-bottom:1px solid #e3eaf3;font-size:15px\">iOS<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u56de\u6536\u65b9\u5f0f<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">GC\uff08\u5783\u573e\u56de\u6536\uff09\uff0c\u5206\u4ee3 + \u5e76\u53d1\u6807\u8bb0<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">ARC\uff08\u81ea\u52a8\u5f15\u7528\u8ba1\u6570\uff09<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u91ca\u653e\u65f6\u673a<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u7531 GC \u51b3\u5b9a\uff0c\u975e\u786e\u5b9a\u6027<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u5f15\u7528\u8ba1\u6570\u5f52\u96f6\u7acb\u5373\u91ca\u653e<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u5178\u578b\u6cc4\u6f0f<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u957f\u751f\u547d\u5468\u671f\u5bf9\u8c61\u6301\u6709 Activity\/Context<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u5faa\u73af\u5f15\u7528\uff08\u5c24\u5176\u95ed\u5305\u6355\u83b7 self\uff09<\/td>\n<\/tr>\n<tr>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">\u6392\u67e5\u5de5\u5177<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">Android Profiler\u3001LeakCanary\u3001MAT<\/td>\n<td style=\"padding:12px 14px;border-bottom:1px solid #eff4fa;color:#3a4a63;line-height:1.75\">Instruments\u3001Xcode Memory Graph<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">Q\uff1aAndroid \u5185\u5b58\u6cc4\u6f0f\u6700\u5e38\u89c1\u7684\u539f\u56e0\uff1f<\/strong><\/p>\n<ul style=\"padding-left:26px;margin:16px 0\">\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u9759\u6001\u53d8\u91cf\u6301\u6709 Activity<\/strong> \u6216 View\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u5185\u90e8\u7c7b\/\u533f\u540d\u7c7b\u6301\u6709\u5916\u90e8 Activity \u5f15\u7528<\/strong>\uff08Handler \u5ef6\u8fdf\u6d88\u606f\u662f\u6700\u7ecf\u5178\u573a\u666f\uff09\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u672a\u6ce8\u9500\u7684\u76d1\u542c\u5668<\/strong>\uff08\u5e7f\u64ad\u3001\u56de\u8c03\u3001EventBus\uff09\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">\u8d44\u6e90\u5bf9\u8c61\u672a\u5173\u95ed\uff08Cursor\u3001\u6587\u4ef6\u6d41\u3001Bitmap \u672a\u56de\u6536\uff09\u3002<\/li>\n<\/ul>\n<pre style=\"background:#0f1a2b;color:#dbe6f5;border-radius:12px;padding:18px 20px;overflow-x:auto;font-size:13.6px;line-height:1.78;margin:22px 0;border:1px solid #1e2c42;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace\"><code style=\"background:none;border:none;color:inherit;padding:0;font-size:inherit;font-family:inherit\">\/\/ \u5178\u578b\u6cc4\u6f0f\uff1aHandler \u9690\u5f0f\u6301\u6709 Activity\uff0c\u5ef6\u8fdf\u6d88\u606f\u672a\u5904\u7406\u5b8c\u5219 Activity \u65e0\u6cd5\u56de\u6536\nclass MyActivity : Activity() {\n    private val handler = Handler(Looper.getMainLooper())\n    override fun onCreate(b: Bundle?) {\n        handler.postDelayed({ \/* ... *\/ }, 60_000)\n    }\n}\n\/\/ \u4fee\u590d\uff1a\u9759\u6001\u5185\u90e8\u7c7b + WeakReference\uff0c\u5e76\u5728 onDestroy \u79fb\u9664\u6240\u6709\u56de\u8c03\n<\/code><\/pre>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">Q\uff1aiOS \u7684\u5faa\u73af\u5f15\u7528\u600e\u4e48\u4ea7\u751f\uff1f\u600e\u4e48\u7834\uff1f<\/strong><br \/>\n\u5bf9\u8c61 A \u5f3a\u5f15\u7528 B\u3001B \u53c8\u5f3a\u5f15\u7528 A\uff0c\u5f15\u7528\u8ba1\u6570\u6c38\u4e0d\u5f52\u96f6\u3002<strong style=\"color:#0f1c2e;font-weight:600\">\u95ed\u5305\u6355\u83b7 self \u662f\u6700\u5e38\u89c1\u573a\u666f<\/strong>\u3002\u89e3\u6cd5\uff1a\u7528 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">weak<\/code> \/ <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">unowned<\/code> \u6253\u7834\u73af\uff08Swift \u4e2d\u5e38\u5199 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">[weak self]<\/code>\uff09\uff1bdelegate \u4e00\u5f8b\u7528 <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">weak<\/code> \u4fee\u9970\u3002<\/p>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #7c6cf0;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-3\">\u4e09\u3001ANR \u4e0e OOM\uff1a\u7ebf\u4e0a\u95ee\u9898\u6392\u67e5<\/h2>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">Q\uff1aANR \u662f\u600e\u4e48\u89e6\u53d1\u7684\uff1f\u600e\u4e48\u6392\u67e5\uff1f<\/strong><br \/>\nAndroid \u4e2d\u4e3b\u7ebf\u7a0b\u5728\u89c4\u5b9a\u65f6\u95f4\u5185\u672a\u54cd\u5e94\u5373\u89e6\u53d1 ANR\uff1a<strong style=\"color:#0f1c2e;font-weight:600\">\u8f93\u5165\u4e8b\u4ef6 5 \u79d2\u5185\u672a\u5904\u7406\u5b8c\u3001BroadcastReceiver 10 \u79d2\u3001Service \u751f\u547d\u5468\u671f 20 \u79d2<\/strong>\u3002<\/p>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u6392\u67e5\u8def\u5f84\uff1a<\/p>\n<ol style=\"padding-left:26px;margin:16px 0\">\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">\u5bfc\u51fa <code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">\/data\/anr\/traces.txt<\/code>\uff0c\u67e5\u770b\u4e3b\u7ebf\u7a0b\u7684\u5806\u6808\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">\u770b\u4e3b\u7ebf\u7a0b\u662f<strong style=\"color:#0f1c2e;font-weight:600\">\u5728\u505a\u8017\u65f6\u4efb\u52a1<\/strong>\uff08\u5927\u91cf\u8ba1\u7b97\u3001I\/O\uff09\uff0c\u8fd8\u662f<strong style=\"color:#0f1c2e;font-weight:600\">\u963b\u585e\u5728\u9501\u6216 Binder \u8c03\u7528<\/strong>\u4e0a\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">\u7ed3\u5408 CPU \u4f7f\u7528\u7387\u5224\u65ad\uff1aCPU \u9ad8\u8bf4\u660e\u5728\u5fd9\uff0cCPU \u4f4e\u5374 ANR \u8bf4\u660e\u88ab\u963b\u585e\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\">\u7ebf\u4e0a\u63a5\u5165 ANR \u76d1\u63a7\uff08WatchDog \u6216\u5b98\u65b9 API\uff09\u91c7\u96c6\u5806\u6808\u3002<\/li>\n<\/ol>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">Q\uff1aOOM \u6709\u54ea\u4e9b\u7c7b\u578b\uff1f\u600e\u4e48\u4f18\u5316\uff1f<\/strong><\/p>\n<ul style=\"padding-left:26px;margin:16px 0\">\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">Java \u5806 OOM<\/strong>\uff1a\u5bf9\u8c61\u592a\u591a\u6216\u6cc4\u6f0f\uff0c\u7528 Profiler \u6293\u5806\u8f6c\u50a8\u5206\u6790\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u5185\u5b58\u6296\u52a8<\/strong>\uff1a\u77ed\u65f6\u95f4\u9891\u7e41\u521b\u5efa\u9500\u6bc1\u5bf9\u8c61\uff0c\u89e6\u53d1\u9891\u7e41 GC\uff0c\u8868\u73b0\u4e3a\u5361\u987f\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u5927\u56fe OOM<\/strong>\uff1a\u56fe\u7247\u672a\u6309\u663e\u793a\u5c3a\u5bf8\u91c7\u6837\uff08<code style=\"background:#eef4fb;color:#0b6bcb;padding:2px 7px;border-radius:5px;font-size:14px;font-family:\"JetBrains Mono\",Consolas,Monaco,\"Courier New\",monospace;border:1px solid #dce8f6;white-space:nowrap\">inSampleSize<\/code>\uff09\u3001\u672a\u53ca\u65f6\u56de\u6536\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u7ebf\u7a0b OOM<\/strong>\uff1a\u7ebf\u7a0b\u6570\u8d85\u4e0a\u9650\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u5360\u6808\u5185\u5b58\uff0c\u9700\u7528\u7ebf\u7a0b\u6c60\u6536\u655b\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u6587\u4ef6\u63cf\u8ff0\u7b26\u8017\u5c3d<\/strong>\uff1a\u6d41\u672a\u5173\u95ed\uff0c\u8868\u73b0\u4e3a Too many open files\u3002<\/li>\n<\/ul>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #7c6cf0;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-4\">\u56db\u3001\u5361\u987f\u6392\u67e5\u7684\u901a\u7528\u65b9\u6cd5\u8bba<\/h2>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">Q\uff1a\u7ebf\u4e0a\u5361\u987f\u600e\u4e48\u5b9a\u4f4d\uff1f<\/strong> \u4e00\u4e2a\u901a\u7528\u56db\u6b65\u6cd5\uff1a<\/p>\n<ol style=\"padding-left:26px;margin:16px 0\">\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u76d1\u63a7\u91c7\u96c6<\/strong>\uff1a\u7528 Choreographer \u5e27\u56de\u8c03\u6216 CADisplayLink \u8ba1\u7b97\u6389\u5e27\u7387\uff0c\u8d85\u8fc7\u9608\u503c\u65f6\u91c7\u6837\u4e3b\u7ebf\u7a0b\u5806\u6808\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u805a\u5408\u5f52\u56e0<\/strong>\uff1a\u628a\u5927\u91cf\u5806\u6808\u6309\u6808\u9876\u805a\u5408\uff0c\u627e\u51fa\u9ad8\u9891\u8017\u65f6\u51fd\u6570\uff08\u800c\u4e0d\u662f\u770b\u5355\u6b21\u6837\u672c\uff09\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u5de5\u5177\u6df1\u6316<\/strong>\uff1aAndroid \u7528 Perfetto\/System Trace\uff0ciOS \u7528 Instruments Time Profiler\uff1b<\/li>\n<li style=\"font-size:16.2px;line-height:1.92;color:#35435c;margin:10px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u89e3\u6cd5\u5f52\u7c7b<\/strong>\uff1a\u4e3b\u7ebf\u7a0b\u8017\u65f6 \u2192 \u5f02\u6b65\u5316\u6216\u5ef6\u8fdf\uff1b\u5e03\u5c40\u590d\u6742 \u2192 \u6241\u5e73\u5316\uff1b\u9891\u7e41\u521b\u5efa\u5bf9\u8c61 \u2192 \u590d\u7528\u6c60\uff1b\u9501\u7ade\u4e89 \u2192 \u7f29\u5c0f\u9501\u7c92\u5ea6\u3002<\/li>\n<\/ol>\n<blockquote style=\"margin:24px 0;padding:16px 22px;background:#f7fafd;border-left:4px solid #7c6cf0;border-radius:0 10px 10px 0;color:#4a5b73;font-size:15.6px;line-height:1.88\">\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\"><strong style=\"color:#0f1c2e;font-weight:600\">\u52a0\u5206\u7b54\u6cd5\uff1a<\/strong>\u63d0\u5230&#8221;<strong style=\"color:#0f1c2e;font-weight:600\">\u76d1\u63a7\u8981\u6709\u91c7\u6837\u7387\u63a7\u5236<\/strong>\uff0c\u5426\u5219\u76d1\u63a7\u672c\u8eab\u4f1a\u9020\u6210\u5361\u987f&#8221;\uff0c\u4ee5\u53ca&#8221;<strong style=\"color:#0f1c2e;font-weight:600\">\u5148\u770b\u805a\u5408\u540e\u7684 Top \u95ee\u9898\uff0c\u4e0d\u8981\u9677\u5165\u5355\u6b21\u8c03\u7528\u6808<\/strong>&#8220;\u3002\u8fd9\u4e24\u70b9\u8bf4\u660e\u4f60\u6709\u7ebf\u4e0a\u7ecf\u9a8c\u3002<\/p>\n<\/blockquote>\n<h2 style=\"font-size:23px;line-height:1.45;font-weight:700;color:#0f1c2e;margin:46px 0 18px;padding:0 0 12px 14px;border-left:5px solid #7c6cf0;border-bottom:1px solid #eef2f7;letter-spacing:.3px\" id=\"sec-5\">\u4e94\u3001\u5c0f\u7ed3<\/h2>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u79fb\u52a8\u7aef\u9762\u8bd5\u7684\u542f\u52a8\u3001\u5185\u5b58\u3001\u5361\u987f\u4e09\u5757\uff0c\u5171\u540c\u7684\u7b54\u9898\u7ed3\u6784\u662f\uff1a<strong style=\"color:#0f1c2e;font-weight:600\">\u8bb2\u6e05\u7cfb\u7edf\u673a\u5236 \u2192 \u6307\u51fa\u5e38\u89c1\u6210\u56e0 \u2192 \u7ed9\u51fa\u6392\u67e5\u8def\u5f84 \u2192 \u843d\u5230\u5177\u4f53\u5de5\u5177\u4e0e\u4ee3\u7801<\/strong>\u3002<\/p>\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\">\u6700\u6709\u6548\u7684\u5907\u8003\u65b9\u5f0f\uff1a\u62ff\u81ea\u5df1\u7684\u9879\u76ee\u8dd1\u4e00\u904d Profiler \/ Instruments\uff0c\u627e\u4e00\u4e2a\u771f\u5b9e\u7684\u6027\u80fd\u95ee\u9898\u5e76\u89e3\u51b3\u6389\u3002\u9762\u8bd5\u5b98\u95ee\u7ec6\u8282\u65f6\uff0c\u8fd9\u6bb5\u7ecf\u5386\u4f1a\u8ba9\u4f60\u7684\u56de\u7b54\u7acb\u523b\u53d8\u5f97\u53ef\u4fe1\u3002<\/p>\n<hr style=\"border:none;border-top:1px solid #eaeef4;margin:34px 0\">\n<p style=\"font-size:16.2px;line-height:1.95;color:#35435c;margin:16px 0;letter-spacing:.2px\"><em style=\"color:#5a6b85;font-style:normal;background:#7c6cf01f;padding:1px 4px;border-radius:4px\">\u53c2\u8003\uff1a<a href=\"https:\/\/developer.android.com\/topic\/performance\" target=\"_blank\" rel=\"noopener\" style=\"color:#7c6cf0;text-decoration:none;border-bottom:1px solid #7c6cf066;transition:opacity .15s\">Android \u6027\u80fd\u5b98\u65b9\u6587\u6863<\/a>\u3001<a href=\"https:\/\/developer.apple.com\/documentation\/xcode\/improving-your-app-s-performance\" target=\"_blank\" rel=\"noopener\" style=\"color:#7c6cf0;text-decoration:none;border-bottom:1px solid #7c6cf066;transition:opacity .15s\">Apple \u6027\u80fd\u8c03\u4f18\u6587\u6863<\/a>\u3002\u7248\u672c\u4e0e\u5de5\u5177\u884c\u4e3a\u4ee5\u5b98\u65b9\u6587\u6863\u4e3a\u51c6\u3002<\/em><\/p>\n<div style=\"margin:42px 0 0;padding:22px 0 0;border-top:1px solid #eaeef4\">\n<div style=\"font-size:13px;color:#93a1b5;letter-spacing:1px;margin-bottom:12px\">\u6807\u7b7e<\/div>\n<p><span style=\"display:inline-block;background:#f3f6fa;border:1px solid #e4eaf2;color:#5b6c85;font-size:13px;padding:5px 12px;border-radius:999px;margin:0 8px 8px 0\">#\u79fb\u52a8\u7aef\u9762\u8bd5<\/span><span style=\"display:inline-block;background:#f3f6fa;border:1px solid #e4eaf2;color:#5b6c85;font-size:13px;padding:5px 12px;border-radius:999px;margin:0 8px 8px 0\">#Android<\/span><span style=\"display:inline-block;background:#f3f6fa;border:1px solid #e4eaf2;color:#5b6c85;font-size:13px;padding:5px 12px;border-radius:999px;margin:0 8px 8px 0\">#iOS<\/span><span style=\"display:inline-block;background:#f3f6fa;border:1px solid #e4eaf2;color:#5b6c85;font-size:13px;padding:5px 12px;border-radius:999px;margin:0 8px 8px 0\">#\u9762\u8bd5<\/span><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u79fb\u52a8\u7aef\u9762\u8bd5\u4e24\u5927\u5206\u6c34\u5cad\uff1a\u80fd\u5426\u8bb2\u6e05 Android\/iOS \u542f\u52a8\u5b8c\u6574\u94fe\u8def\uff0c\u4ee5\u53ca\u9047\u5230\u5d29\u6e83\u4e0e\u5361\u6b7b\u80fd\u5426\u7ed9\u51fa\u6392\u67e5\u8def\u5f84\u3002\u672c\u6587\u8986\u76d6\u542f\u52a8\u6d41\u7a0b\u3001\u5185\u5b58\u7ba1\u7406\u673a\u5236\u3001ANR\/OOM \u6392\u67e5\u4e0e\u5361\u987f\u5b9a\u4f4d\u56db\u6b65\u6cd5\u3002<\/p>\n","protected":false},"author":1,"featured_media":159,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,11],"tags":[44,45,74,66],"class_list":["post-95","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mobile-question-bank","category-question-bank","tag-android","tag-ios","tag-74","tag-66"],"_links":{"self":[{"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/posts\/95","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/comments?post=95"}],"version-history":[{"count":2,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/posts\/95\/revisions"}],"predecessor-version":[{"id":188,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/posts\/95\/revisions\/188"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/media\/159"}],"wp:attachment":[{"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/media?parent=95"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/categories?post=95"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ziliaochi.cn\/index.php\/wp-json\/wp\/v2\/tags?post=95"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}