{"id":10898,"date":"2023-11-28T21:47:05","date_gmt":"2023-11-28T13:47:05","guid":{"rendered":"https:\/\/wx.kaifamiao.info\/?p=10898"},"modified":"2023-12-07T16:00:02","modified_gmt":"2023-12-07T08:00:02","slug":"jvm-zhong-shen-me-qing-kuang-fa-sheng-zhan-yi-chu","status":"publish","type":"post","link":"http:\/\/wx.kaifamiao.info\/index.php\/2023\/11\/28\/jvm-zhong-shen-me-qing-kuang-fa-sheng-zhan-yi-chu\/","title":{"rendered":"JVM\u4e2d\u4ec0\u4e48\u60c5\u51b5\u53d1\u751f\u6808\u6ea2\u51fa\uff1f"},"content":{"rendered":"<p>\u6808\u6ea2\u51fa\uff08Stack Overflow\uff09\u901a\u5e38\u53d1\u751f\u5728Java\u865a\u62df\u673a\u7684\u65b9\u6cd5\u8c03\u7528\u6808\u4e0a\uff0c\u662f\u7531\u4e8e\u65b9\u6cd5\u8c03\u7528\u7684\u6df1\u5ea6\u8fc7\u5927\u5bfc\u81f4\u6808\u7a7a\u95f4\u4e0d\u8db3\u800c\u89e6\u53d1\u7684\u5f02\u5e38\u3002\u4e3b\u8981\u7684\u539f\u56e0\u6709\u4ee5\u4e0b\u51e0\u79cd\u60c5\u51b5\uff1a<\/p>\n<ol>\n<li>\n<strong>\u9012\u5f52\u8c03\u7528\u5c42\u6b21\u592a\u6df1\uff1a<\/strong> \u5f53\u4e00\u4e2a\u65b9\u6cd5\u9012\u5f52\u8c03\u7528\u81ea\u5df1\u6216\u5176\u4ed6\u65b9\u6cd5\u7684\u6b21\u6570\u8fc7\u591a\uff0c\u5bfc\u81f4\u65b9\u6cd5\u8c03\u7528\u6808\u5c42\u6b21\u4e0d\u65ad\u589e\u52a0\uff0c\u6700\u7ec8\u8d85\u8fc7\u4e86\u6808\u7684\u5bb9\u91cf\uff0c\u5c31\u4f1a\u53d1\u751f\u6808\u6ea2\u51fa\u3002<\/p>\n<pre><code class=\"language-java\">public class StackOverflowExample {\n    public static void recursiveMethod() {\n        recursiveMethod();\n    }\n\n    public static void main(String[] args) {\n        recursiveMethod();\n    }\n}\n<\/code><\/pre>\n<p>\u4e0a\u8ff0\u793a\u4f8b\u4e2d\u7684<code>recursiveMethod<\/code>\u65b9\u6cd5\u65e0\u9650\u9012\u5f52\u8c03\u7528\uff0c\u6700\u7ec8\u5bfc\u81f4\u6808\u6ea2\u51fa\u3002\n<\/li>\n<li>\n<strong>\u65b9\u6cd5\u8c03\u7528\u8fc7\u591a\uff1a<\/strong> \u5f53\u65b9\u6cd5\u8c03\u7528\u94fe\u5f88\u957f\uff0c\u65b9\u6cd5\u5d4c\u5957\u5c42\u6b21\u5f88\u6df1\uff0c\u5bfc\u81f4\u65b9\u6cd5\u8c03\u7528\u6808\u5c42\u6b21\u589e\u52a0\uff0c\u540c\u6837\u4e5f\u53ef\u80fd\u5bfc\u81f4\u6808\u6ea2\u51fa\u3002<\/p>\n<pre><code class=\"language-java\">public class StackOverflowExample {\n    public static void methodA() {\n        methodB();\n    }\n\n    public static void methodB() {\n        methodA();\n    }\n\n    public static void main(String[] args) {\n        methodA();\n    }\n}\n<\/code><\/pre>\n<p>\u4e0a\u8ff0\u793a\u4f8b\u4e2d\uff0c<code>methodA<\/code>\u548c<code>methodB<\/code>\u76f8\u4e92\u8c03\u7528\uff0c\u5bfc\u81f4\u6808\u6ea2\u51fa\u3002\n<\/li>\n<li>\n<strong>\u8fc7\u591a\u7684\u5c40\u90e8\u53d8\u91cf\uff1a<\/strong> \u5f53\u65b9\u6cd5\u4e2d\u58f0\u660e\u7684\u5c40\u90e8\u53d8\u91cf\u5360\u7528\u7684\u7a7a\u95f4\u8fc7\u591a\uff0c\u5bfc\u81f4\u65b9\u6cd5\u8c03\u7528\u6808\u4e2d\u5c40\u90e8\u53d8\u91cf\u8868\u7684\u7a7a\u95f4\u4e0d\u8db3\uff0c\u4e5f\u53ef\u80fd\u5bfc\u81f4\u6808\u6ea2\u51fa\u3002<\/p>\n<pre><code class=\"language-java\">public class StackOverflowExample {\n    public static void methodWithLargeLocalVariables() {\n        int a1, a2, a3, a4, a5, \/* ... *\/ a1000;\n        \/\/ ...\n    }\n\n    public static void main(String[] args) {\n        methodWithLargeLocalVariables();\n    }\n}\n<\/code><\/pre>\n<p>\u4e0a\u8ff0\u793a\u4f8b\u4e2d\uff0c<code>methodWithLargeLocalVariables<\/code>\u65b9\u6cd5\u4e2d\u58f0\u660e\u4e86\u5927\u91cf\u7684\u5c40\u90e8\u53d8\u91cf\uff0c\u53ef\u80fd\u5bfc\u81f4\u6808\u6ea2\u51fa\u3002\n<\/li>\n<\/ol>\n<p>\u6808\u6ea2\u51fa\u662f\u4e00\u79cd\u8fd0\u884c\u65f6\u5f02\u5e38\uff0c\u4e00\u65e6\u53d1\u751f\uff0c\u7a0b\u5e8f\u5c06\u7ec8\u6b62\u8fd0\u884c\u3002\u5728\u5904\u7406\u6808\u6ea2\u51fa\u65f6\uff0c\u53ef\u4ee5\u8003\u8651\u51cf\u5c0f\u9012\u5f52\u6df1\u5ea6\u3001\u4f18\u5316\u9012\u5f52\u7b97\u6cd5\u3001\u589e\u52a0\u6808\u7684\u5927\u5c0f\u7b49\u65b9\u5f0f\u3002\u5728Java\u865a\u62df\u673a\u7684\u542f\u52a8\u53c2\u6570\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>-Xss<\/code>\u9009\u9879\u6765\u6307\u5b9a\u6808\u7684\u5927\u5c0f\u3002\u4f8b\u5982\uff0c<code>-Xss1m<\/code>\u8868\u793a\u8bbe\u7f6e\u6808\u5927\u5c0f\u4e3a1MB\u3002\u4f46\u662f\uff0c\u8fc7\u5ea6\u589e\u5927\u6808\u7684\u5927\u5c0f\u53ef\u80fd\u4f1a\u5f71\u54cd\u7cfb\u7edf\u7684\u6027\u80fd\u548c\u8d44\u6e90\u6d88\u8017\uff0c\u56e0\u6b64\u9700\u8981\u8c28\u614e\u8c03\u6574\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6808\u6ea2\u51fa\uff08Stack Overflow\uff09\u901a\u5e38\u53d1\u751f\u5728Java\u865a\u62df\u673a\u7684\u65b9\u6cd5\u8c03\u7528\u6808\u4e0a\uff0c\u662f\u7531\u4e8e\u65b9\u6cd5\u8c03\u7528\u7684\u6df1\u5ea6\u8fc7\u5927\u5bfc\u81f4\u6808\u7a7a [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[119],"tags":[],"class_list":["post-10898","post","type-post","status-publish","format-standard","hentry","category-jvm"],"_links":{"self":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/10898","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/comments?post=10898"}],"version-history":[{"count":2,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/10898\/revisions"}],"predecessor-version":[{"id":16914,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/10898\/revisions\/16914"}],"wp:attachment":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/media?parent=10898"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/categories?post=10898"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/tags?post=10898"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}