Path: utzoo!utgpu!watmath!maytag!watstat!dmurdoch From: dmurdoch@watstat.waterloo.edu (Duncan Murdoch) Newsgroups: comp.lang.pascal Subject: Re: Memory usage under Turbo Pascal 5 Message-ID: <290@maytag.waterloo.edu> Date: 7 Jul 89 13:10:16 GMT References: <3405@shlump.dec.com> Sender: daemon@maytag.waterloo.edu Reply-To: dmurdoch@watstat.waterloo.edu (Duncan Murdoch) Distribution: na Organization: U. of Waterloo, Ontario Lines: 18 In article <3405@shlump.dec.com> granoff@vaxwrk.dec.com (Mark H. Granoff) writes: >The Turbo Pascal built-in procedure MemAvail returns the number of free bytes >as a Longint value. The built-in procedure MaxAvail returns a similar value, >but is the total amount of memory in the system. MaxAvail - MemAvail is the >total amount of memory your system and application (and TSRs, etc) are using. No, MaxAvail is the size of the largest contiguous area that's free. It's never bigger than MemAvail. On the subject of MaxAvail, there's one pitfall: though the area is contiguous, it's not necessarily available. TP has a limit of 65520 bytes for a single object (to let it be loaded anywhere within a single 65536 byte segment), while MaxAvail could be as large as the entire heap. If MaxAvail happens to be equal to 65550 bytes, then getmem(v,MaxAvail) will give you just 14 = word(65550) bytes.