A test malloc program makes 64-Bit FC-4 dying

Nigel Wade nmw at ion.le.ac.uk
Fri Nov 4 09:22:16 UTC 2005


Reuben D. Budiardja wrote:
> Hello,
> I have a small program that I use to check malloc. The program supposed to 
> exhaust memory (heap) from malloc, then quit. Running this program on a 
> 32-Bit RHEL 4, RHEL 3, FC-4, I got the program to terminated pretty quicky 
> after malloc cannot allocated more memory. 
> However, when I run this program on my desktop: AMD64 FC 4 64-bit, the program 
> does not terminate after a while. But it grinds this machine to almost to a 
> halt, and I got page-swapping, etc. I finally managed to kill the program.

That's what you would expect to happen if you are allowed to allocate the full 
virtual memory space. After the physical memory is exhausted you start 
allocating from swap, and the system grinds to a halt.

> 
> My question is, why does this happen in FC-4 64-bit ? what is the difference 
> on this machine and other machine ? This supposedly should not happend since 
> I run this program as regular user, and it seems "dangerous" that a regular 
> user can almost bring this machine down by running this. 

I would expect the difference is in your user limits. On the other machines you 
must have a limit set which is less than the physical memory.

> 
> I checked 'ulimit' on my shell and it's unlimited. But even when I set 'ulimit 
> -m 12000', the same thing still happened. On other machines, i didn't have to 
> do anything. I've checked also /etc/security/limits.conf and they are all 
> default (ie. nothing in it). Below is the program. Any help or info about 
> this is appreciated. 
> 

Try ulimit -v, the virtual memory size. ulimit is a bash shell builtin. Look at 
the man page for bash. Other machines may already have a limit on virtual memory 
set by their admins.


-- 
Nigel Wade, System Administrator, Space Plasma Physics Group,
             University of Leicester, Leicester, LE1 7RH, UK
E-mail :    nmw at ion.le.ac.uk
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555




More information about the users mailing list