phk malloc, was (Re: ptmalloc2)

Matthew Dillon dillon at apollo.backplane.com
Tue Feb 22 19:46:40 PST 2005


:Jonathan Dama wrote:
:> If you put 'Z' into your malloc option strings, malloc will
:> touch all of the allocated pages for you.
:
:Will this cause malloc to guarantee that it, or the OS will actually
:make the requested amount of physical memory available to such a process,
:and never give them back to the OS as long as the process is reusing
:that memory, and not calling any allocation functions after this memory
:is preallocated?

    Dan, this guarenteed memory stuff comes up every few months pretty much
    every since I ever started working with UNIX.  I have yet to see a single
    program that would benefit from it.  Not one.  The answer is:  libc
    has no support for it because 99.9% of the programs that exist in this
    world have no use for it and would not benefit from it.  If you want
    total control over the backing store for a program's memory there is
    nothing stopping you from writing your own malloc wrapper to wire the
    memory or to use a file-backed mmap or something like that.

    The plain fact of the matter is that for any system where it matters,
    the person running the program will set a datasize limit or the program
    itself will be self-regulating.

					-Matt
					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>





More information about the Kernel mailing list