Name: gm110360 Date: 10/27/2003
FULL PRODUCT VERSION :
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_01-b06)
Java HotSpot(TM) Client VM (build 1.4.2_01-b06, mixed mode)
FULL OS VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
EXTRA RELEVANT SYSTEM CONFIGURATION :
I have 256 MB of RAM + 256 MB swap file.
A DESCRIPTION OF THE PROBLEM :
I execute program which code is submited as "Source code for an executable test case" in this bug report form. When I run program with small java thread stack size (given by parameter -Xss) program terminates with java.lang.StackOverflowError which is correct for given program. When I run it using larger stack size (near my real RAM size) program terminates with "Error occurred during initialization of VM java.lang.OutOfMemoryError: unable to create new native thread" which is maybe also correct. But when I run program with stack size larger than my physical memory java.exe crashes (i.e. I get message "The instruction at "0x080a87d3" referenced memory at "0x00000008". The memory could not be "written".") which is not correct (java.exe should terminate normaly with some Java exception or error).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile given program.
Run: java -Xss512M A
where 512 is number larger than computer physical memory size.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expect:
Exception in thread "main" java.lang.StackOverflowError
since my program executes infinite recustion.
ACTUAL -
Message box with error:
The instruction at "0x080a87d3" referenced memory at "0x00000008". The memory could not be "written".
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
// File A.java
public class A {
public static void main(String[] aaa) {
new A().test(new B());
}
public void test(B b) {
b.test(this);
}
}
class B {
public void test(A a) {
a.test(this);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use smaller thread stack size than your physical memory size.
(Incident Review ID: 217956)
======================================================================