RLIMIT_DATA
Maximum size of the data segment: initialized data, uninitialized data and the heap.
- Resource number
- 2
- Row in /proc/PID/limits
- Max data size
- bash ulimit flag
- ulimit -d
- Unit in /proc/PID/limits
- bytes
- Group
- Memory
What happens at the limit
brk(2), sbrk(3) and, since Linux 4.7, mmap(2) of private writable mappings, fail with ENOMEM.
Error names: ENOMEM.
Before 4.7 this limit only stopped the brk heap, so a process could mmap its way around it. Shared and file-backed mappings still are not counted. If you want one number for "this thing may not eat the box", RLIMIT_AS is blunter and a cgroup memory limit is better.
Check a running process with grep -i "Max data size" /proc/PID/limits, or paste the whole file into the limits reader. Inspect or change one on a live process with prlimit --pid PID(util-linux).
Sources
Resource numbers are from asm-generic/resource.h; a few architectures (Alpha, MIPS, SPARC) number some limits differently. The list of syscall cards is matched by name from the card text on this site, not from the kernel source. Spot one that's wrong? Tell Rod.