Message-ID: <37319029.C14E8B7C@softhome.net> From: Chris Mears X-Mailer: Mozilla 4.04 [en] (Win95; I) MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: Dynamic memory allocation References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 38 Date: Thu, 06 May 1999 22:50:49 +1000 NNTP-Posting-Host: 139.134.195.27 X-Trace: newsfeeds.bigpond.com 925994662 139.134.195.27 (Thu, 06 May 1999 22:44:22 EST) NNTP-Posting-Date: Thu, 06 May 1999 22:44:22 EST Organization: Telstra BigPond Internet Services (http://www.bigpond.com) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I *think* that when your program stops running, all the memory it used (whether you freed it or not) is given back to the OS. The reason you free memory explicitly in your program is so you can re-use it again (in the same program). I *think*. Chris Paul Richards wrote: > > Hi, > I just got to the bit in my book about Dynamic memory allocation so in > my quest to break stuff I wrote this: > > #include > > int main(void) > { > for (;;) > new double; > } > > I know you're all jealous!! > > I was gonna see what happens to memory that doesn't get freed and also > what happens when you run out. Well when I run it there is a long > stretch of thrashing the HD (making swapfile?) and then it says "ran out > of virtual memory for 'new'" or something similar. The program stops > after that message but what happened to all the memory that I allocated? > Is it still allocated and Win95 has just paged it into the swapfile? > -- > Paul Richards (AKA Pauldoo) > EMAIL paul AT dunvegan1 DOT demon DOT co DOT uk > FAX +44 (0)870 0522086 > HTTP www.dunvegan1.demon.co.uk/paul/ > ICQ 14106503