LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Per-process memory queries on Redhat 5.3 (32 and 64-bit) (http://www.linuxquestions.org/questions/linux-software-2/per-process-memory-queries-on-redhat-5-3-32-and-64-bit-749000/)

sd136742 08-20-2009 07:41 AM

Per-process memory queries on Redhat 5.3 (32 and 64-bit)
 
Hi There

I have two machines (HP DL380's), with 8Gb of RAM each, and Intel Xeon CPU's. One is installed with Redhat 5.3 32-bit with PAE, and the other with RedHat 5.3 64-bit.

I'm doing some testing with regards to the per-process memory limits. I'm running a script which just executes a never-ending loop increasing the size of a variable with each iteration. Script code is...

VAR="a"
echo "" > /tmp/output.txt
while [ 1 ]
do
VAR=$VAR$VAR
ps -eo pid,rss,vsize >> /tmp/output.txt
done

I'm monitoring the ps output generated in the output.txt.

On the 32-bit system, the process ends with the following message...

xrealloc: cannot reallocate 1073741952 bytes (0 bytes allocated)

At the time the process crashes, the ps output shows a Resident Set Size of 1574060kb, and a VSIZE of 2101664.

On the 64-bit machine, the same error is displayed...

xrealloc: cannot reallocate 18446744071562068096 bytes (0 bytes allocated)

and the ps output shows a RSS of 3146768 and a VSIZE of 4260432.

Therefore, the 32-bit machine can only address 1.5Gb per process of Physical RAM before the process exits. I was under the impression that this should be greater?

The 64-bit machine can only address 3Gb of physical RAM per process. I was under the impression that this should be MUCH higher?

Furethermore, whilst this script was running, I was periodically running 'free -om', which always showed that swap wasn't being used at all. I would of expected swap to be filling up with this script running.

Can anyone explain what's going on here, or am I completly on the wrong track?

Thanks in advance.

Stephen

johnsfine 08-20-2009 09:12 AM

Quote:

Originally Posted by sd136742 (Post 3650776)
xrealloc: cannot reallocate 1073741952 bytes (0 bytes allocated)

At the time the process crashes, the ps output shows a Resident Set Size of 1574060kb, and a VSIZE of 2101664.

Notice it is a reallocate. So there isn't a large enough contiguous chunk of free virtual address space. There may be smaller chunks of free virtual address space adding up to nearly a GB.

The VSIZE is 2GB. A 32 bit Linux kernel can be configured to limit processes to 2GB virtual, but I don't think your kernel is configured that way. I think you could use 3GB virtual.

Quote:

On the 64-bit machine, the same error is displayed...

xrealloc: cannot reallocate 18446744071562068096 bytes (0 bytes allocated)
Looks like a bug in the code reporting the error. It might not have actually tried to reallocate that much. It might have tried and failed a reasonable amount and reported it wrong.

But maybe it is a bug in the code that actually tried to do the reallocate.

Either way, it appears someone wrote some code for 32 bit and someone recompiled it for 64 bit without testing for places in the code that assumed 32 bit.

Quote:

Therefore, the 32-bit machine can only address 1.5Gb per process of Physical RAM before the process exits.
The limit is on virtual address space, not physical size. Then the physical size is smaller than the virtual address space because of a number of ordinary effects.

So:
1) You have a limit of 3GB of virtual address space.
2) That filled up with just 2GB of virtual memory because the program asked for more in too large a virtual chunk.
3) That occupied only 1.5GB of actual memory for various reasons.

Quote:

The 64-bit machine can only address 3Gb of physical RAM per process.
The limit (or bug) must be in the program you were running (I assume that was bash). Under the conditions you described, the kernel would not limit a process anywhere near that low.

chrism01 08-20-2009 09:31 PM

You need to read this http://kbase.redhat.com/faq/docs/DOC-6571 and possibly follow some of the links as well.


All times are GMT -5. The time now is 01:30 PM.