qemu-devel
[Top][All Lists]
Advanced

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

Re: qemu-x86_64 runs out of memory


From: Richard Henderson
Subject: Re: qemu-x86_64 runs out of memory
Date: Tue, 13 Sep 2022 11:53:22 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

On 9/13/22 10:35, Andreas Schwab wrote:
$ cat mmap.c
#include <stdio.h>
#include <sys/mman.h>

int
main (void)
{
   void *A;
   size_t L = 0, U, Max = 0;
   for (U = 1; ; U *= 2)
     {
       A = mmap (0, U, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, 
-1, 0);
       if (A == (void *) -1)
        break;
       else
        munmap (A, U);
     }
   while (L + 1 < U)
     {
       size_t M = L + (U - L) / 2;
       A = mmap (0, M, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, 
-1, 0);
       if (A == (void *) -1)
        U = M;
       else
        {
          Max = M;
          munmap(A, M);
          L = M;
        }
     }
   printf ("%zx\n", Max);
}
$ cc -O2 -g -Wall -std=gnu11 -g     mmap.c   -o mmap
$ ./mmap
7f672e5ff000
$ qemu-x86_64 ./mmap
Killed


I suspect this is the same as

  https://gitlab.com/qemu-project/qemu/-/issues/290

Needs a reorg of memory region tracking for {linux,bsd}-user.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]