Re: max size limit for mmap MAP_ANONYMOUS in different x86_64 kernels

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

 



On Wed, Oct 21, 2009 at 10:38 AM, Mark Farnell <mark.farnell@xxxxxxxxx> wrote:
> I ran this piece of code on centOS 5.3 x86_64 and ubuntu amd64 jaunty
> server kernel:
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <sys/types.h>
> #include <unistd.h>
> #include <sys/mman.h>
> #include <string.h>
>
>
> #define SIZE (size_t)1024 * 1024 * 1024 * 16     /* 16GB */
>
> int main(void) {
>  void *buf = mmap(NULL, SIZE, PROT_READ | PROT_WRITE,
>                   MAP_SHARED | MAP_ANONYMOUS, -1, 0);
>  if (MAP_FAILED == buf) {
>    fprintf(stderr, "map failed\n");
>    exit(EXIT_FAILURE);
>  }
>
>  return EXIT_SUCCESS;
> }
>
> However strace shows that mmap fails with -ENOMEM

Big, yes, but is that 16 GB virtual address space you're asking for is
really available continously? Try to split that up....let's say into
16 times 1 GB, or 32 times 512 MB etc and see the difference.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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