JDK-6316878 : JVM should use STACK_SIZE_PARAM_IS_A_RESERVATION when creating threads on Windows
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-08-28
  • Updated: 2012-10-08
  • Resolved: 2005-09-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b51Fixed
Description
If default stack size is not 0 or if user has specified stack size with -Xss,
JVM will pass the stack size value through "stack_size" argument to
_beginthreadex() when creating a new thread. However, on Windows "stack_size"
refers to the initially committed space. It does not affect total (reserved)
stack size at all if it's smaller than the default value specified in
PE header. If the "stack_size" value is larger than default value, Windows will 
round up stack size to the nearest multiple of 1MB. 

Since b49 the default stack size in JVM has been changed to 320k, while the 
value in PE header remains 256k. This can cause OOM errors and/or performance 
degradation if the application has many threads, because each thread will 
take 1MB real memory.

We should use STACK_SIZE_PARAM_IS_A_RESERVATION when creating new threads.

Comments
EVALUATION Fixed by passing the flag when creating new threads. Default stack size is changed back to 0. Launcher make files are modified to build java launcher with 320K default stack size (will be put back separately to J2SE workspace).
02-09-2005