qemu-riscv64 mmap will exhaust all physical memory

#include <stdio.h>
#include <sys/mman.h>
#include <errno.h>

int main(int argc, char **argv)
{
    void *addr;
    size_t a = 6002;
    size_t length = a << 30;
    addr = mmap(NULL, length, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
    if (addr == MAP_FAILED)
    {
        printf("errno:%d\n", errno);
        return 1;
    }
    getchar();
    return 0;
}
riscv64-linux-gnu-gcc main.c
/home/yuyang/projects/qemu/build/qemu-riscv64 -L /usr/riscv64-linux-gnu -E LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/l
ib ./a.out

image

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information