lkml.org 
[lkml]   [2000]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Avoiding OOM on overcommit...?
On Sat, Mar 25, 2000 at 02:27:43AM -0500, Sandy Harris wrote:
> James Sutherland wrote:
>
> > >> >BUT "when I use up the resources given to me" - If the resources
> > >> >weren't available, why did the system give them to me?
> > >>
> > >> It didn't.
> > >
> > >If he did a [mc]alloc to ALLOCate the the memory and got a non-null
> > >return, it certainly said it did.
> >
> > No - malloc() doesn't allocate MEMORY, it allocates ADDRESS SPACE to
> > put memory in later. This may not be what you wanted, but that's what
> > it does.
>
> Both 'man malloc' and 'info malloc' on my SuSE 6.3 system say it
> "allocates memory". At the very least, these pages need some text in
> the BUGS section explaining what they actually do.

malloc() is not a kernel function, it's a libc function. This
function is implemented to first try to use already available memory
from the heap space (i.e. free()d memory) or get some more heap space
if there is no chunk available that's big enough. The relevant kernel
function for that is brk() (or mmap() for bigger chunks). Their man
pages say nothing about "allocating memory".

> Also, you describe what malloc() currently does on Linux, but it is by
> no means clear that that's what it should do.
>
> Checking the C standard at:

The C standard isn't relevant to the Linux kernel interfaces.

--
Andreas E. Bombe <andreas.bombe@munich.netsurf.de>
http://home.pages.de/~andreas.bombe/ DSA key 0x04880A44

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.066 / U:7.924 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site