Path: utzoo!lsuc!ncrcan!brambo!sid From: sid@brambo.UUCP (Sid Van den Heede) Newsgroups: comp.sys.atari.st Subject: Re: Three questions. Keywords: MWC system() malloc() free() Message-ID: <304@brambo.UUCP> Date: 2 Mar 88 20:22:36 GMT References: <1988Feb22.221218.13780@jarvis.csri.toronto.edu> Reply-To: sid@brambo.UUCP (Sid Van den Heede) Organization: Bramalea Software Inc., Bramalea, Ont. Lines: 21 In article <1988Feb22.221218.13780@jarvis.csri.toronto.edu> juancho@dgp.toronto.edu (John Buchanan) writes: > > 3) How reliable are the malloc() and free() functions >provided with MWC. I have had no problems with the MWC routines themselves. But I have run out of memory (according to malloc()) while there was still plenty of memory left (prox 1/4Mb according to malloc(-1) or Malloc(-1)...it's been a while and I don't have my documentation here). This is due to the problem with the memory allocation scheme in TOS. When malloc() is called, it calls Malloc to get a chunk of memory, from which it doles out the amount you requested. Subsequent malloc() calls give you more of the memory left from the previous Malloc or calls Malloc again as appropriate. After a small number of Malloc calls (20, 40?) you don't get any more. -- Sid Van den Heede Voice: 416-792-1137 sid@brambo.UUCP FAX: 416-792-1536 ...!utgpu!telly!brambo!sid Bramalea Software, Suite 406, 44 Peel Centre Dr, Brampton, Ontario L6T 4B5