FULL PRODUCT VERSION :
java version " 1.7.0_21 "
Java(TM) SE Runtime Environment (build 1.7.0_21-b12)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
FULL OS VERSION :
Mac OS X 10.8.3
System Version: OS X 10.8.3 (12D78)
Kernel Version: Darwin 12.3.0
Darwin minastirith.rdu.intervolve.com 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64
EXTRA RELEVANT SYSTEM CONFIGURATION :
17 " MacBook Pro
2.3 GHz Intel Core i7
16 GB 1333 MHz DDR3
A DESCRIPTION OF THE PROBLEM :
Memory consumption by the JVM for even minimal programs is wildly high when maxfiles hard limit is manually set on Mac OS X.
By default, OS X's soft and hard maxfiles limits are " 256 " and " unlmiited " , respectively. Beginning with OS X 10.7, " unlimited " was removed as a valid option for the maxfiles hard limit when it is being specified by the user. Therefore, in order to specify a maxfiles soft limit, a maxfiles hard limit that is not " unlimited " must also be specified.
The memory consumption of even a minimal Java program seems to scale with the maxfiles hard limit setting. With a maxfiles hard limit of 2^24 files, a sample program consisting of only a single call to JOptionPane.showMessageDialog(Component, Object), uses 1.18 GB of memory on my system. With a maxfiles hard limit of (2^31) - 1, which seems to be the maximum, this sample program consumes all available memory on my system (16 GB).
Variations in the maxfiles soft limit do not seem to produce any variations in memory usage. Running the same sample program with Java 1.6.0_45-b06-451 produces nominal memory usage regardless of the maxfiles hard limit setting (~53 MB).
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes
REGRESSION. Last worked in version 6u45
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Verify current, most likely default, soft and hard maxfile limits in Mac OS X via the following Terminal command:
$ sudo launchctl limit maxfiles
Output should be:
maxfiles 256 unlimited
The first entry is the soft limit, 256, and the second is the hard limit, unlimited.
3. Verify that the sample program executes with nominal memory usage using Java 1.7.0_21. Verify that the sample program executes with nominal memory usage using Java 1.6.0.
4. Specify a different hard maxfiles limit (2^24) in /etc/launchd.conf:
sudo vi /etc/launchd.conf
File contents:
limit maxfiles 256 16777216
5. Reboot, and verify that the new configuration has been applied by repeating step 1.
6. Run the sample program using Java 1.7.0_21 and observe high memory usage. Run the sample program using Java 1.6.0 and observe nominal memory usage.
7. Specify the maximum hard maxfiles limit ((2^31) - 1) in /etc/launchd.conf:
sudo vi /etc/launchd.conf
File contents:
limit maxfiles 256 2147483647
8. Reboot, and verify that the new configuration has been applied by repeating step 1.
9. Run the sample program with Java 1.7.0_21 and observe high memory usage, most likely using all available free memory. You may have to force kill JVM, so be prepared. Run the sample program with Java 1.6.0 and observe nominal memory usage
10. Return the /etc/launchd.conf file to its original state, or delete it if you created it, then reboot in order to return the system to its original configuration. Verify that the soft and hard maxfiles limits have returned to their default values by repeating step 1.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected behavior: Minimal memory usage by the JVM regardless of the hard maxfiles limit.
Actual behavior: Wildly high memory usage by the JVM that seems to increase relative to the hard maxfiles limit.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.JOptionPane;
public class MaxFiles {
public static void main(String[] args) {
JOptionPane.showMessageDialog(null, " This is a test. " );
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Specify a low hard maxfiles limit or use the default.
java version " 1.7.0_21 "
Java(TM) SE Runtime Environment (build 1.7.0_21-b12)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
FULL OS VERSION :
Mac OS X 10.8.3
System Version: OS X 10.8.3 (12D78)
Kernel Version: Darwin 12.3.0
Darwin minastirith.rdu.intervolve.com 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64
EXTRA RELEVANT SYSTEM CONFIGURATION :
17 " MacBook Pro
2.3 GHz Intel Core i7
16 GB 1333 MHz DDR3
A DESCRIPTION OF THE PROBLEM :
Memory consumption by the JVM for even minimal programs is wildly high when maxfiles hard limit is manually set on Mac OS X.
By default, OS X's soft and hard maxfiles limits are " 256 " and " unlmiited " , respectively. Beginning with OS X 10.7, " unlimited " was removed as a valid option for the maxfiles hard limit when it is being specified by the user. Therefore, in order to specify a maxfiles soft limit, a maxfiles hard limit that is not " unlimited " must also be specified.
The memory consumption of even a minimal Java program seems to scale with the maxfiles hard limit setting. With a maxfiles hard limit of 2^24 files, a sample program consisting of only a single call to JOptionPane.showMessageDialog(Component, Object), uses 1.18 GB of memory on my system. With a maxfiles hard limit of (2^31) - 1, which seems to be the maximum, this sample program consumes all available memory on my system (16 GB).
Variations in the maxfiles soft limit do not seem to produce any variations in memory usage. Running the same sample program with Java 1.6.0_45-b06-451 produces nominal memory usage regardless of the maxfiles hard limit setting (~53 MB).
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes
REGRESSION. Last worked in version 6u45
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Verify current, most likely default, soft and hard maxfile limits in Mac OS X via the following Terminal command:
$ sudo launchctl limit maxfiles
Output should be:
maxfiles 256 unlimited
The first entry is the soft limit, 256, and the second is the hard limit, unlimited.
3. Verify that the sample program executes with nominal memory usage using Java 1.7.0_21. Verify that the sample program executes with nominal memory usage using Java 1.6.0.
4. Specify a different hard maxfiles limit (2^24) in /etc/launchd.conf:
sudo vi /etc/launchd.conf
File contents:
limit maxfiles 256 16777216
5. Reboot, and verify that the new configuration has been applied by repeating step 1.
6. Run the sample program using Java 1.7.0_21 and observe high memory usage. Run the sample program using Java 1.6.0 and observe nominal memory usage.
7. Specify the maximum hard maxfiles limit ((2^31) - 1) in /etc/launchd.conf:
sudo vi /etc/launchd.conf
File contents:
limit maxfiles 256 2147483647
8. Reboot, and verify that the new configuration has been applied by repeating step 1.
9. Run the sample program with Java 1.7.0_21 and observe high memory usage, most likely using all available free memory. You may have to force kill JVM, so be prepared. Run the sample program with Java 1.6.0 and observe nominal memory usage
10. Return the /etc/launchd.conf file to its original state, or delete it if you created it, then reboot in order to return the system to its original configuration. Verify that the soft and hard maxfiles limits have returned to their default values by repeating step 1.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected behavior: Minimal memory usage by the JVM regardless of the hard maxfiles limit.
Actual behavior: Wildly high memory usage by the JVM that seems to increase relative to the hard maxfiles limit.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.JOptionPane;
public class MaxFiles {
public static void main(String[] args) {
JOptionPane.showMessageDialog(null, " This is a test. " );
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Specify a low hard maxfiles limit or use the default.