The last time I used WebLogic to set-xmxxxxx to 2 GB, I couldn't start it. I just got up when I set it to a small point. I was so angry at the time that I couldn't even get up with 2 GB. Today I saw an explanation and turned around.
This time, an old friend raised this question. I remember that when a Java master proposed it in blogjava, he was scolded. You have come to different conclusions using Java-xmxxxxx-version. Later, the old friend said it was about mb. I refuted at the time that "I have set 8 GB of memory on the server. I use two Tomcat servers, each of which is 2 GB ". To this end, I opened all the C code for JVM memory management, without any conclusion. I am not a Linux kernel programmer, but I have read the Linux source code. I know that the computer addressing space of the 32-bit architecture is 2 ^ 32 = 4g, and the addressing space of the Intel Pentium Pro processor is 36, the PAE register is added to the CPU. Used to process four extra addresses
Therefore, PAE technology can achieve a maximum of 2 ^ 36 = 64g addressing. With the Linux kernel source code, the standard Linux kernel uses a allocation ratio for physical memory management, that is, 1/4 of the physical memory is the kernel space ), the remaining 3/4 is the user space. Therefore, on a 4G memory server, the maximum memory that a user process can use is 3 GB. When a process is transferred to the CPU by the kernel, data in different address spaces will be transferred to the user process space in 4 GB, which can actually use 3 GB. In the ia32 architecture, a single process cannot use memory space larger than 4 GB. However, I remember that I allocated about GB of memory to the MySQL server, instead of 32 to the power of 2-1. The computer on which I allocated 2 GB of memory was IBM's rs6000.
After testing on different platforms, I got a rough value of about 1.2 GB for Win2k and GB for NT. The reason is, classic Vm and hotspot VM store the continuous address in the user zone. nt places the kernel DLLs in the address space starting with 0x7c, so there is only <2g space in NT, therefore, the maximum JVM heap usage is 2 GB. your DLL starts at 0x77000000, and your application starts at 0x00400000. I am only sure that sun may give the DLL address to rebase to prevent conflicts with some JVM plug-ins, so there is very little space to use. the reason is that the default address of DLL compilation in Windows is 10000000. Generally, rebase is required before release, the-B parameter of rebase specifies a starting address. The recommended address of msdn is 0x60000000. This tool is used with Visual Studio and PLA Issue the tform SDK.
Example:
Rebase.exe-B 0x6d000000/JDK/JRE/bin /*. dll/JDK/JRE/bin/hotspot/JVM. in this way, your JVM uses more memory. At present, I can only get Bea's jrockit and can only use 1.8g memory. It seems that every JDK compilation has made some effort.
Currently, only the minimum value of Bea-xmx is 16 Mb. Sun's data is incomplete. Fortunately, Java is open-source and sun is not enough.
Information provided by Sun
Maximum address space per Process
Operating system maximum address space per Process
RedHat Linux 32 bit 2 GB
RedHat Linux 64-bit 3 GB
Windows 98/2000/NT/ME/XP 2 GB
Solaris x86 (32 bit) 4 GB
Solaris 32 bit 4 GB
Solaris 64 bit terabytes
The preceding document is incorrect. 32-bit RedHat server can use 3G memory using highmem technology.
Solaris is the birth platform of Java.
I asked Bea engineers and came to a general conclusion,
Windows 2003/XP using the/3 GB switch (32-bit OS)
1.85 GB-jrockit 5.0 r25.2 (SP2)
2.85 GB-jrock IT 5.0 R26 (SP3)
Windows 2003/XP x64 Edition with a 32-bit JVM (64-bit OS)
2.05 GB-jrockit 5.0 r25.2 (SP2)
3.85 GB-jrock IT 5.0 R26 (SP3)
For Windows 2000 to enable the 3G mode, Windows core programming is very clear, Boot. ini Add/3G parameters.
[Boot loader]
Timeout = 30
Default = multi (0) disk (0) RDISK (0) Partition (2)/winnt
[Operating systems]
Multi (0) disk (0) RDISK (0) Partition (2)/winnt = "???? "/3 GB
Note :"???? "In the previous example can be the programmatic name of any of the following operating system versions:
Windows XP Professional
Windows Server 2003
Windows Server 2003, Enterprise Edition
Windows Server 2003, datacenter Edition
Windows 2000 Advanced Server
Windows 2000 datacenter Server
Windows NT Server 4.0, Enterprise Edition
Test it on my machine. I configure it myself, 1 GB memory, and WINXP.
No 3G mode turned on, sun's JDK 1.6 Java-xmx1447m-version, runtime error, jrockit-R27.1.0-jdk1.5.0_08 is 1911 M, 3G mode Sun's JDK has not changed, IBM j9 VM (build 2.3, j2re 1.5.0 IBM j9 2.3 Windows XP x86-32 j9vmwi3223-2006050
4 (JIT enabled) 3G and 2g the same, Java-xmx1787m-version problems, jrockit-R27.1.0-jdk1.5.0_08 is 2899 m,Note that the xmx memory is not the physical memory. The physical memory of my host is only 1 GB..
Jrockit is worthy of being the first virtual machine in Java, but unfortunately it is not open source.
Today, we analyzed the maximum memory size of JVM of several popular JVM versions of different companies. The results are as follows:
Maximum memory (MB) Client Maximum memory (MB) server of the company's JVM version
Sun 1.5.x 1492 1520
Sun 1.5.5 (Linux) 2634 2660
Sun 1.4.2 1564 1564
Sun 1.4.2 (Linux) 1900 1260
IBM 1.4.2 (Linux) 2047 N/
Bea jrockit 1.5 (U3) 1909 1902
Unless otherwise specified, the JVM version runs under the Windows operating system.
Appendix:How to obtain the maximum available memory of JVM
UseJava-xmxw.m-XX: MaxPermSize = 60 m-versionCommand to perform the test, and then gradually increase the XXXX value. If the execution is normal, the specified memory size is available; otherwise, the error message is printed.
The final virtual machine actually assigned
Total memory size = heap memory + non-heap memory
1200 m: the heap memory size. If the latter parameter is not specified, there is a maximum number limit. Many articles on the Internet Think This Is The JVM memory,-XmxSet the maximum heap memory.
60 m: Non-heap memory size,-XX:MaxPermsizeIt is actually a permanent domain memory. Outside the heap memory, it belongs to the non-heap memory part. I tested jdk1.5 as if the default value is 62 MB, that is, the default memory of the non-heap part is obtained)
Sun hotspot 1.4.1 uses the generational collector, which divides the heap into three main domains: new domain, old domain, and permanent domain. All new objects generated by Sun JVM are placed in the new domain. Once an object goes through a certain number of garbage collection cycles, it will get the validity period and enter the old domain. In the permanent domain, Sun JVM stores class and method objects. In terms of configuration, the permanent domain is an independent domain and is not considered a part of the heap.
The JDK has different maximum allowable memory values in different versions. Therefore, you need to test the memory value in actual applications.
This table shows that if your machine has too much memory, you can only run several more instances to provide machine utilization, such as running tomcat, you can install several Tomcat servers and create clusters.
Alimail
Dongzi said:
The maximum memory in Windows should also be related to the reserved address space of the NT kernel. It seems that the NT kernel occupies 2 GB of address space by default, therefore, the application cannot get more than 2 GB of memory. Remember that there is a parameter that can make nt only occupy 1 GB of memory, so that the application has 3 GB address space available, in the corresponding environment, the maximum memory size allowed by the JVM may also increase.
At 05-10-06
Purpureleaf users said:
The addressing space of each application (not addressing) in Windows is generally 2 GB or 3 GB, depending on a parameter. However, as long as a group of specific functions are used to allocate memory, the addressing space of each application can be much larger than 4 GB.
JDK may not be able to set that large memory, but it is not caused by windows. It is caused by JDK and cannot be set on Linux. It seems that Java programmers are still not familiar with windows.