[lkml]   [2000]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectOvercommittable memory (Was: Some questions about linux kernel.)
Den 20-Mar-00 13:12:16 skrev James Sutherland følgende om "Re: Some questions about linux kernel.":
> On Sun, 19 Mar 2000 15:50:07 -0600, you wrote:

>>NOPE - if the process requests it and is granted it, then it should have
>>access to it. It is not up to the system to say "here it is, but don't use
>>that part of it, because I really didn't give it".

> malloc() just allocates address SPACE. TOUCHING the memory then
> populates that space, which is how I can use malloc() for a nice,
> simple sparse matrix implementation. (On Win32, you have to mess
> around trapping exceptions in userland and allocating the memory
> yourself...)

Note that malloc() is documented as allocating memory, regardless of
whether you actually touch it or not. Any programmer relies on that.

>>We are talking about the sum of all concurrent requests, and the system
>>aborting when part of the requests already granted turns out to not be

> No. The malloc() call requested address space, and that succeeded -
> the address space was available.

> What is NOT available, however, is memory to populate that area fully.
> So what?

So you have a broken malloc().

> I could well be using malloc() to allocate a SPARSE matrix,
> in which case I certainly do NOT want it to populate the whole thing!

Then using malloc() to create the matrix in one go is the wrong thing to

> I would be seriously irritated if your disk quota system denied me
> permission to create a sparse file on the basis that, if fully
> populated, it would overrun my quota. Why apply the same system to
> memory?

An lseek()/write() combination is documented to permit the file system
to create a sparse file. malloc() etc. has no permission to create sparse
memory blocks. That's why.


| Rask Ingemann Lambertsen | E-mail: |
| Please do NOT Cc: to me or the | WWW: |
| mailing list. I am on the list.| "ThrustMe" on XPilot, ARCnet and IRC |
| Which is worse: Ignorance or apathy? Who knows... Who cares... |

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

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