> Can someone please explain to me how and why an app would
> allocate a large amount of memory and then not use it? Please
> give specific examples since I can't fathom the reason. I think
> an app that requests a lot of memory and then doesn't use it is
> BAD - broken as designed. I can see legitimate allocation of
> SMALL amounts of unused memory as speculation in time critical
> code, or for optimization, etc.. but not large amounts.
Apache using mod_perl may reach a process size of 40Mb. It may then have to
fork 100 times. Each fork/exec implicitly allocates another 40Mb (due to
possible COW), for a total of 4Gb of possible memory needed should each
process touch every page it has. Of course, most processes die before ever
touching most of that memory, so the allocated space is not used.
What you're missing is that the malloc case, the fork case, the stack
expansion case, the shared library case, and the various other cases that
have been discussed are all fundamentally the same, from the point of view
of the kernel's VM system.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to firstname.lastname@example.org
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Fri Mar 31 2000 - 21:00:14 EST