Subject: Re: Replacement for grep(1) (part 2)
To: Daniel C. Sobral <dcs@newsguy.com>
From: Jon Ribbens <jon@oaktree.co.uk>
List: tech-userlevel
Date: 07/12/1999 02:24:24
"Daniel C. Sobral" <dcs@newsguy.com> wrote:
> > > OTOH, though, FreeBSD's malloc() is very unlikely to return an out
> > > of memory error.
> > 
> > Why is that?
> 
> Because memory (as in *real* memory, either RAM or swap) is
> allocated on-demand. So you can allocate any amount of virtual
> memory that the system can possibly provide you, even though you'll
> run out of memory much earlier, because other resources are also
> consuming it.

Yuck. That's a complete abomination. What's the point of it? It's turning
an out-of-memory situation from an easily-detected recoverable temporary
resource shortage which can be worked-around or waited out, into an
unrecoverable fatal error. Do a significant number of programs really
request memory which they then proceed not to use?

> > What happens if the process hits its resource limits?
> 
> If the system runs out of memory, the biggest process is killed. It
> might or might not be the one demanding additional memory.

No, if the *process* hits its *administrative* resource limits.
i.e. setrlimit(2).

Cheers


Jon
-- 
\/ Jon Ribbens / jon@oaktree.co.uk