Limitation of process memeory consumption on Linux
Hello,
I recently encountered a problem of running JVM (1.3.1_09) on Linux platform. Our Linux (2.4.20-8custom) was built on Intel 32-bit base PC, and had 4G memeory, plus newly-added 4G memory (so 8G memory). Before extra 4G memory was added, we used the following command to run the server program, and it worked fine. java ... Xms1024m Xmx1024m ... Since the server workload has been getting higher so after adding extra 4G, we tried to use more heap size on JVM as the following command. java ... Xms2048m Xmx2048m ... However, the error occured. Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine. I checked the free memeory on our linux, and it showed about 6G. My question is: 1. Does linux limit the memory usage for single process, or a single user? How much memory can a process (or a user) use? 2.1. If the answer of questoin 1 is yes, can we change it in order to give more memeory to a (specific) process? 2.2. If the answer of questoin 1 is no, any suggestion of helping dealing with my situation? Thank you for your help. |
1) I think that on Linux 32 bits, the limit is 3 Gigabytes (out of 4 adressable).
2) Use a 64 bit O/S , CPU and JVM |
Quote:
Refer to these man pages for more information: man bash # search for "ulimit" man setrlimit |
Quote:
It would be acceptable, if I could at least use 2G heap size on JVM. But, I actually cannot, although there are 6G free memeory. Don't know why. :scratch: |
Quote:
JVM should be able to use more memory than 1G for heap size, according some Java discussions. |
Both your Linux kernel, and especially your JVM, are way out of date.
Although it's probably not practical for you to update everything at once, JDK 1.5.x, kernel 2.6.x running on a 64-bit CPU would be ideal for you. Anyway, here's a link with more info: http://forum.java.sun.com/thread.jsp...sageID=2626955 |
Check "sizeof(void *)" to see whether you can use more than 2GB at all in any application. You must recompile your kernel. A 64-bit CPU isn't mandatory as as long as the kernel and compiler both support 64-bits addresses.
|
Quote:
Actually, I am thinking of the same way. But, for doing my duty, I have to be 100% sure that there is no alternative, cheap way to fix this. :study: Otherwise, if I purpose this monemy-expending sulotion, and someone some other day find out a very easy and no cost solution, I would get ... something from my boss.:eek: |
Quote:
Many thanks. |
Quote:
This is plain wrong, a process running under a 32 bit O/S won't be able to address more than 2^32 = 4 gigabytes of (virtual) memory. As Linux is reserving 1 giga for the kernel, that leaves 3 gigabytes for the process. |
Quote:
Quoting /usr/src/linux/Documentation/Configure.help: Quote:
|
Quote:
PS: I may be wrong on the possibility or feasibility that the OS itself does the mapping rather than a mandatory PAE-like feature in the CPU. |
I read nothing in your posting that tells a process can address more than 4 GB under Linux ...
You are confusing what the kernel is able to dispatch and what a process is able to use. |
Quote:
Nothing prevents a process to address +4GB if both the OS and compiler support it. You'd have to test it with 5 calls to mmap() 1GB each. If sizeof(void *), sizeof(rlim_t) and maybe sizeof(size_t) all equal 8, then where's the problem ? If they are 4-bytes wide, even on 64-bits machines processes wouldn't be able to see +4GB |
Quote:
The compiler can't help, a pointer is 4 bytes on a 32 bit CPU. Quote:
Quote:
Quote:
|
All times are GMT -5. The time now is 12:20 PM. |