Path: utzoo!lsuc!ncrcan!brambo!sid From: sid@brambo.UUCP (Sid Van den Heede) Newsgroups: comp.sys.atari.st Subject: Re: RAM disks (was: small assesment of some formaters) Keywords: format, review Message-ID: <309@brambo.UUCP> Date: 4 Mar 88 04:15:47 GMT References: <439@dukempd.UUCP> <1418@water.waterloo.edu> <3335@watcgl.waterloo.edu> Reply-To: sid@brambo.UUCP (Sid Van den Heede) Organization: Bramalea Software Inc., Bramalea, Ont. Lines: 49 In article <3335@watcgl.waterloo.edu> jafischer@lily.waterloo.edu (Jonathan A. Fischer) writes: > o The main problem is with the Malloc() system routine. Its bugs > are notorious, but in short, there is a fixed limit on the number > of Malloc's any one application can perform. In fact, I once > caught a message on Compuserve claiming that even if you're just > doing something like: > while (1) { > buf = Malloc(size); > Mfree(buf); > } > then it _still_ stops giving you memory after a while. (I'd like > someone to confirm this). The following program succeeds on my system. I'm using MWC version 2.0 and the Nov 20 1985 version of the TOS ROMs. The program stops after 10,000 repititions. When the address returned by Malloc was displayed, it was always the same. #include #include main() { long buf; long count = 0; printf ("%ld bytes memory available.\n", Malloc(-1L)); while (1) { if ((buf = Malloc(1000L)) < 0L) { printf ("Malloc stopped giving memory after %ld calls.\n", count); break; } if (++count > 10000L) { printf ("Malloc ok after 10000 tries.\n"); break; } if (Mfree(buf) < 0L) { printf ("Mfree failed after %ld tries.\n", count); break; } } } -- 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