Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Sep 1997 06:27:34 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        karpen@ocean.campus.luth.se (Mikael Karpberg)
Cc:        sef@Kithrup.COM, hackers@FreeBSD.ORG
Subject:   Re: Bug in malloc/free (was: Memory leak in getservbyXXX?)
Message-ID:  <199709220627.XAA16498@usr07.primenet.com>
In-Reply-To: <199709220412.GAA08834@ocean.campus.luth.se> from "Mikael Karpberg" at Sep 22, 97 06:12:36 am

next in thread | previous in thread | raw e-mail | index | archive | help
> However, if I understand everything right, phkmalloc doesn't shrink the
> program's space, but simply tells the OS that the page's contents are not
> important and can be disregarded. The program still has enough space
> allocated on the swap to write the page to, but there is no need to write
> it to that space, and read it back when the memory is accessed. Instead
> the page is not reclaimed until the OS needs a free page, and if the program
> wants to use the page later, it gets a zeroed page from the system. This
> can be guaranteed since there is space on the swap for this page, so another
> program can have an idle page be swapped out to there, and the program can
> then get that page, after it has been zeroed.
> 
> Then it would indeed be guaranteed that the second malloc() would succeed.
> 
> Am I right? Maybe I'm completely off instead? :-)

You're wrong.  Memory is overcommited.  This means that there is no
guarantee that a backing page exists for the kernel to be able to
associate it with the process as a result of the fault.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199709220627.XAA16498>