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 05:59:05AM +0000, David Holland wrote:
> On Tue, Jul 09, 2019 at 10:24:53AM -0700, Graham Percival wrote:
> > RLIMIT_DATA
> > This is the maximum size of a data segment of the process, in bytes. If
> > this limit is exceeded, the malloc() function shall fail with errno set to
> > [ENOMEM].
> > http://pubs.opengroup.org/onlinepubs/9699919799/functions/getrlimit.html
> >
> > The relevant part is the second sentence.
>
> 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.
My sincere apologies for wasting everybody's time.
> (Note: if you're trying to do something practical, you might find
> RLIMIT_AS or RLIMIT_RSS more helpful.)
We were checking all three, actually:
https://github.com/Tarsnap/scrypt/blob/master/lib/util/memlimit.c#L153
but since RLIMIT_DATA is not relevant, I've submitted a patch to remove it.
Using that patch allows the scrypt tests to complete successfully on NetBSD.
Thank you for the clarifications, and sorry again,
- Graham
Home |
Main Index |
Thread Index |
Old Index