Messages in this thread | | | Date | Fri, 17 Mar 2000 01:30:20 -0800 (PST) | From | David Whysong <> | Subject | Re: Overcommitable memory?? |
| |
On Fri, 17 Mar 2000, James Sutherland wrote: >On Fri, 17 Mar 2000, David Whysong wrote: > >> So malloc() returns success when I ask for an 800 megabyte array on a >> machine with only ~640 megabytes of free virtual memory. > >It's not supposed to do that, AIUI - malloc() will only succeed if either >(a) overcommit_memory is enabled (which disables all sanity checking - you >want 2Gb on a 4Mb 386? Here it is...) OR (b) the system stands a *chance* >of successfully allocating it (i.e. it has the amount you requested free).
That's more or less what it does (see below). The problem is, what do you mean by "free" memory? -- there are several ways to measure this, none of which are all that useful.
>It doesn't ALLOCATE that memory to you immediately - but it is supposed to >check that it could do, if needed. (So the source appears to indicate, >anyway.)
I'm not looking at the kernel source (big mistake in this mailing list, I know...), I'm looking at it from an app developer's point of view. From my experiments, it seems that with /proc/sys/vm/overcommit_memory=0, malloc() will succeed so long as you ask for less than the total RAM+swap on the machine. If overcommit_memory=1 anything goes.
Dave
David Whysong dwhysong@physics.ucsb.edu Astrophysics graduate student University of California, Santa Barbara My public PGP keys are on my web page - http://www.physics.ucsb.edu/~dwhysong DSS PGP Key 0x903F5BD6 : FE78 91FE 4508 106F 7C88 1706 B792 6995 903F 5BD6 D-H PGP key 0x5DAB0F91 : BC33 0F36 FCCD E72C 441F 663A 72ED 7FB7 5DAB 0F91
- 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/
| |