NetBSD-Users archive

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

Re: ulimit -d/-m do not actually work



On Tue, Oct 22, 2024 at 06:23:50PM -0400, Greg Troxel wrote:

> My test program can allocate 53548 kB, when total vsize is 200000 kB
> 
> $ ulimit -v 200000
> $ ./test-limits
> 53548
> 
> so this does limit memory usage.

RLIMIT_AS limits address space usage. malloc() is nowadays based on
mmap() instead of sbrk(), but the limit covers all kinds of  
mappings including loaded text, shared libraries or the stack
allocation.

It still doesn't work as a memory limit in case of overcommitment.
You can malloc() memory, which takes address space immediately,
but only requires physical memory when you touch the allocation.


Greetings,
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index