Re: Maximum amount of dynamic memory allocattion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pharaoh . wrote:

Afaik, for a 32 - bit machine we can not address more than 2^32 addresses. Now, If I have another machine with 1 GB RAM and 4 GB swap then, as per above inference I should be able to allocated 5 GB memory at max ! Out of this only lower 4 GB will be
addressable.

Is there some loophole in the above argument?

On a 32 bit x86 system, there is 3GB of virtual address space
available for user space.  All allocations, including the mapping
of the executable, shared libraries, the stack, etc. need to fit
inside that.

Address randomization (a security method) eats up some address
space.

This limits the maximum amount of memory allocated my malloc to
the remaining 2.8 or so GB.

The reason you cannot "allocate more than you can address" is
that malloc returns a virtual address.  Once virtual memory
fills up, there's no other place to map the memory.

--
Politics is the struggle between those who want to make their country
the best in the world, and those who believe it already is.  Each group
calls the other unpatriotic.

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux