POSIX rlimit: What exactly can we assume about RLIMIT_DATA?

前端 未结 1 955
名媛妹妹
名媛妹妹 2021-02-20 03:22

Prequisites

POSIX.1 2008 specifies the setrlimit() and getrlimit() functions. Various constants are provided for the resource

相关标签:
1条回答
  • 2021-02-20 04:10

    FreeBSD also shares the problem of malloc(3) being implemented using mmap(2) in the default malloc implementation. I ran into this when porting a product from FreeBSD 6 to 7, where the switch happened. We switched the default limit for each process from RLIMIT_DATA=512M to RLIMIT_VMEM=512M, i.e. limit the virtual memory allocation to 512MB.

    As for whether this violates POSIX, I don't know. My gut feeling is that lots of things violate POSIX and a 100% POSIX compliant system is as rare as a strictly-confirming C compiler.

    EDIT: heh, and now I see that FreeBSD's name RLIMIT_VMEM is non-standard; they define RLIMIT_AS as RLIMIT_VMEM for POSIX compatibility.

    0 讨论(0)
提交回复
热议问题