Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!medar!jseymour From: jseymour@medar.com (James Seymour) Newsgroups: comp.sys.amiga.programmer Subject: Re: free() in SAS C Keywords: free SAS Message-ID: <1991May03.225751.26999@medar.com> Date: 3 May 91 22:57:51 GMT References: <1991May02.143148.22732@edb.tih.no> Distribution: comp Organization: Medar, Inc. Farmington Hills, MI Lines: 44 In article <1991May02.143148.22732@edb.tih.no> karlm@epsilon.tih.no (Karl Martin Lund) writes: > >I've had some problems while using the free() function in SAS C version >5.10. It doesn't seem to free the memory to the system before the program >exits. It does, however, free the memory in a way such that the same >program can use it again when malloc is called. Has anybody any ideas of >whats's the problem, or is it made that way to minimize problems with >memory fragmetation? That is normal behaviour. When memory is free'd it is returned to a local memory pool (frequently referred to as an arena) for later re-use by the same process (program). Adjacent free blocks are merged (this is referred to as coalescing) so that any subsequent larger requests can be satisfied from the local memory pool. >I am doing a lot of big, temporary memory allocations which I want to >free to the system after use. Does anyone know a way to do this in a >ANSI compatible way? No. There is no ANSI compatable (or even *remotely* portable) way to return un-used memory to the system [other than process termination :-)]. Such a beast would be highly operating system and compiler dependent. The problems you are encountering are not unique to either the SAS package or the Amiga environment. The same set of "problems" exist on nearly every system I've worked with (or, at least, those I can remember), other than the real-time ones. (Thank the powers that be and the good engineers at Motorola and Commodore Amiga that you aren't limited by some inane 640k limit!) >Thanks for any help! __ > / / >KMLUND __ / / > \ \/ / > \/_/ictory Not much help, but you're welcome anyway... -- Jim Seymour | Medar, Inc. ...!uunet!medar!jseymour | 38700 Grand River Ave. jseymour@medar.com | Farmington Hills, MI. 48331 CIS: 72730,1166 GEnie: jseymour | FAX: (313)477-8897