JVM Stack, Frame and Stack Overflow
This chapter provides tutorial notes and example codes on JVM stack, frame and stack overflow. Topics include introduction of JVM stacks and frames; condition of StackOverflow exception; setting stack size limit with -Xss; estimating frame size; impact of stack size on JVM footprint; stack area expansion and limitation; stack behavior difference between HotSpot and JRockit.
These sections are omitted from this Web preview version. To view the full content,
see information on how to obtain the full version this book.
What Is JVM Stack?
StackOverflowError Exception Test
-Xss JVM Option for Stack Size
Frame Impact of Extra Statements
JVM Stack Expansion and Footprint
JVM Stack Expansion and OutOfMemoryError
Largest Stack Size for HotSpot on Windows
Default Stack Sizes of HotSpot and JRockit
JRockit Frame Size Smaller than HotSpot
JRockit Expanding Stacks in Bigger Chunks
JRockit Running Out Of Memory Quicker
Largest Stack Size for JRockit on Windows
- JVM creates one stack per execution thread.
- For each nested method call, a new frame added on the top of the stack
to store local variables, partial results and method call data.
- The stack size can be limited by the -Xss option.
- JVM footprint increases when more frames are added or more stacks are added.
- 32-bit Windows system can only support applications with up to 1.5 GB of memory.
- JRockit uses smaller frames but uses heap memory to help making nested method calls.
Table of Contents
About This Book
JVM (Java Virtual Machine) Specification
Java HotSpot VM - JVM by Oracle/Sun
java.lang.Runtime Class - The JVM Instance
java.lang.System Class - The Operating System
ClassLoader Class - Class Loaders
Class Class - Class Reflections
JVM Runtime Data Areas
►JVM Stack, Frame and Stack Overflow
Thread Testing Program and Result
CPU Impact of Multi-Thread Applications
I/O Impact of Multi-Thread Applications
CDS (Class Data Sharing)
Micro Benchmark Runner and JVM Options
Micro Benchmark Tests on "int" Operations
Micro Benchmark Tests on "long" Operations
Micro Benchmark Tests in JIT Compilation Mode
Micro Benchmark Tests on "float" and "double" Operations
OpenJ9 by Eclipse Foundation
JRockit JVM 28.2.7 by Oracle Corporation
Full Version in PDF/EPUB