package com.mousycoder.mycode.happy_jvm; /** * @version 1.0 * @author: mousycoder * @date: 2019-06-11 15:45 */ public class TestStackDeep1 { private static int count = 0; public static void recursion(long a,long b,long c) { long e = 1, f= 2,g =3 ,h=4,i=5,k=6,q=7,x=8,y=9,z=10; count++; recursion(a,b,c); } public static void recursion(){ count++; recursion(); } public static void main(String[] args) { try { recursion(1,2,3); } catch (Throwable e) { System.out.println("deep of calling = " + count); e.printStackTrace(); } } }
其中 recursion(long a,long b,long c) 方法的栈帧如下,一共13 个long类型的局部变量一共占用 26 个字
感谢您的耐心阅读,如果您发现文章中有一些没表述清楚的,或者是不对的地方,请给我留言,您的鼓励是作者写作最大的动力。
作 者 : @mousycoder
原文出处 : http://mousycoder.com/thinking-in-jvm/6/
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。