Skip to content

Instantly share code, notes, and snippets.

@asela38
Last active May 17, 2018 02:59
Show Gist options
  • Save asela38/477e0b5359d0e4b7340a670ca01e464e to your computer and use it in GitHub Desktop.
Save asela38/477e0b5359d0e4b7340a670ca01e464e to your computer and use it in GitHub Desktop.
Program to Check Stack Size Change
public class TestStackSize {
public static void main(String[] args) {
System.out.println(IntStream.generate(() -> {
AtomicInteger i = new AtomicInteger(0);
try {
new TestStackSize().call(i);
} catch (Throwable e) {
return i.get();
}
return 0;
}).limit(15).skip(5).peek(System.out::println).average());
}
private void call(AtomicInteger i) {
i.incrementAndGet();
call(i);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment