Re: Maximum amount of dynamic memory allocattion

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

 



Rik van Riel wrote:

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.

Indeed.

If you're not mapping purely anonymous memory, and instead are mapping a file (a library, a data file, whatever the heck you want really here) then you can map and unmap that file into the address space while a program is running - but you can't do this directly with malloc'd memory. So during the lifetime of a process, you might have many many GBs of mappings, just not at the same moment in time. There's no equivalent to kmap/kunmap type foo in userland.

In theory, it'd be possible to hack your kernel (e.g. on an embedded system able to physically address more than 32bit but not virtually) to expose ranges of a much larger physical block of memory (e.g. you'd map /dev/mem ranges directly afterward) depending upon some ioctl (or whatever) but that's all a horrible special case hack really.

Jon.

--
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