Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!ugle.unit.no!nuug!ifi!enag From: enag@ifi.uio.no (Erik Naggum) Newsgroups: comp.lang.c Subject: Re: Turboc 2.0 malloc/free/coreleft Message-ID: Date: 31 Jan 91 23:23:08 GMT References: <1991Jan30.172158.2769@ux1.cso.uiuc.edu> Sender: enag@ifi.uio.no (Erik Naggum) Organization: Naggum Software, Oslo, Norway Lines: 22 Nntp-Posting-Host: hild.ifi.uio.no In-Reply-To: bloomqui@osiris.cso.uiuc.edu's message of 30 Jan 91 17:21:58 GMT Originator: enag@hild In article <1991Jan30.172158.2769@ux1.cso.uiuc.edu> bloomqui@osiris.cso.uiuc.edu (Kim Bloomquist) writes: The program performs as expected. Memory is allocated to hold s then free() deallocates s making available the same number of bytes (63,704) we started with. However, when the comments are removed from around the printf/gets statements the following output is produced. The last call to coreleft shows only 63,082 bytes free and not the original 63,690 bytes. Question 1: What is being allocated to the missing 608 bytes? Question 2: Can this memory (the 608 bytes) be deallocated? printf and gets are stdio routines, which allocate buffer space for hitherto unused streams. See setbuf(3) for a way to disable that. BTW, since this buffer space allocation occurs after your allocation, the free may not actually release any memory because your allocated block is no longer the "top-most" allocated block. Your "608 bytes" may thus be inaccurate. -- [Erik Naggum] Snail: Naggum Software / BOX 1570 VIKA / 0118 OSLO / NORWAY Mail: , My opinions. Wail: +47-2-836-863 Another int'l standards dude.