Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!apple!agate!usenet.ins.cwru.edu!ncoast!davewt From: davewt@NCoast.ORG (David Wright) Newsgroups: comp.sys.amiga.programmer Subject: Re: free() in SAS C Message-ID: <1991May6.023409.13079@NCoast.ORG> Date: 6 May 91 02:34:09 GMT References: <1991May02.143148.22732@edb.tih.no> Organization: North Coast Public Access Un*x (ncoast) Lines: 23 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? >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? You really should be using the Amiga-specific calls to do this, AllocMem() and FreeMem(). These will do what you want, and are needed if you want to specify flags such as MEMF_CHIP, MEMF_PUBLIC, MEMF_CLEAR, etc. the m/alloc() and free() functions are just provided for ANSI compliance and compatibility with Unix C compilers, and will hold onto the memory until program exit assuming you might want it again (under ANSI C you are supposed to be able to alloc a block of memory, free it, and alloc it again without losing the contents, and some programs make use of this, so it is required for the SAS/C functions to work similarly). Dave