Kenneth Brody
4/14/2011 8:42:00 PM
On 4/14/2011 1:27 PM, Giorgio wrote:
> Hi all, I am trying to understand how exactly memory management in linux
> (OpenSUSE) takes place.
> I have compiled the following program:
[... kepp calling malloc() until program crashes ...]
> on a linux workstation running a 64bit OpenSuse, with 24 GB RAM.
> I run the program with
> memorytest 1073751800
> thus allocating memory 1 GB per cycle.
>
> The program output is
>
> n=0 x=0x7f751b1cd010
[...]
> n=24 x=0x7f6f1b185010
> Segmentation fault
>
> The program stops after allocating 24 GB, that is the physical memory
> limit: why does it not go as far as 64 bit allocation allows? I'd expect
> it to continue allocating memory (and paging) till all the paging memory
> is exhausted, or virtual space addressing is saturated, whichever
> the first.
[...]
Consider, too, that the O/S may impose a limit on the amount of memory a
program can access, to prevent runaway programs from crashing the system.
(On Linux platforms, there is a command [as well as a system call] "ulimit"
which will show this limit, and allow privileged accounts to increase it.)
--
Kenneth Brody