tech-userlevel archive

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

Re: malloc() exceeds RLIMIT_DATA



On Wed, Jul 10, 2019 at 08:40:43PM -0700, Graham Percival wrote:
 > > Ah, but how do you ask malloc to exceed RLIMIT_DATA? Not by passing it
 > > a large number, or any number, since that doesn't change the size of
 > > any data segment.
 > 
 > Aha!  I misunderstood "this limit" to mean "the number returned by
 > getrlimit()", not "the size of the data segment".  So I thought that second
 > sentence was about talking about what should happen if you passed malloc() a
 > large value.

Ah, so we were all talking past one another. Good thing I wrote that
post, I guess :-)

In practice (across arbitrary platforms) I wouldn't count on malloc
necessarily respecting any of these limits, including the limit
imposed by the amount of DRAM in the known universe. In addition to
bugs and perhaps unexpected phenomena like NetBSD's non-sbrk malloc,
AFAIK there's a faction out there (connected with C++? dunno) who
think it's incorrect for malloc to fail, ever, so if they're in
control it won't. Instead, at some unpredictable point you get SIGSEGV
or SIGKILL, like if the system ran out of swap.

 > My sincere apologies for wasting everybody's time.

Eh, no worries :-)

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index