From owner-freebsd-questions Wed Mar 22 17:17:54 2000 Delivered-To: freebsd-questions@freebsd.org Received: from hotmail.com (f37.law8.hotmail.com [216.33.241.37]) by hub.freebsd.org (Postfix) with SMTP id 3AD9237B9C1 for ; Wed, 22 Mar 2000 17:17:51 -0800 (PST) (envelope-from hotkaveh@hotmail.com) Received: (qmail 70638 invoked by uid 0); 23 Mar 2000 01:17:50 -0000 Message-ID: <20000323011750.70637.qmail@hotmail.com> Received: from 193.10.111.71 by www.hotmail.com with HTTP; Wed, 22 Mar 2000 17:17:50 PST X-Originating-IP: [193.10.111.71] From: "Kave p.Ram" To: questions@freebsd.org Subject: memory management in BSD Date: Thu, 23 Mar 2000 01:17:50 GMT Mime-Version: 1.0 Content-Type: text/plain; format=flowed Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi ! i did some cool/crazy experiments with malloc(3) and free(3) and watched the whole show in another terminal running ` /usr/bin/top ' it leaves a lot of questions on my mind which concludes that i have a lot to learn on memory management. thanx to Alfred Perlstein & Dirk Myers for highlights . regards, /kave >From: Alfred Perlstein >To: "Kave p.Ram" >CC: questions@FreeBSD.ORG >Subject: Re: memory management in BSD >Date: Wed, 22 Mar 2000 16:05:27 -0800 > >* Kave p.Ram [000322 15:52] wrote: > > Hi ! > > > > I have a question on memory management in FreeBSD . > > suppose i write a bogus piece of software which just allocates > > about 5 Mb of memory without freeing it later . > > > > if i run this software 10 times then I have allocated totally about > > 50 Mb of available memory. (but not at once) > > > > my question is : if a dumb person like me forget to free the allocated > > memory dedicated to this piece of code , how does the system (after the >end > > of execution ) knows that those memory areas that this software used is >free > > to reuse ? > >When the program exits its memory will be free'd back to the system, if >the program doesn't exit and the memory is needed, it's likely that the >memory will be swapped out to disk, if you run out of swap and memory the >system is likely to get cranky and nuke a process in order to free up >some resources. > >-Alfred >From: Dirk Myers >I'm not 100% sure what you're asking, but here's a try at an answer. > >The operating system keeps track of which parts of memory it's >promised to which process. When the process exits, all the memory >promised to that process is available to the system. > > > thanx for any suggestion :-) > >I hope this is what you're asking. For details, see _The Design >and Implementation of the 4.4BSD Operating System_. > >Dirk dirkm@teleport.com >-- >There's a fine line between cleverness and idiocy. ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message