djo7613@blake.acs.washington.edu (Dick O'Connor) (07/06/89)
A user I know is working on a Turbo Pascal application that is getting a bit big as far as memory usage goes. Since there is a variable amount of data in memory at any point in time during execution, we're having trouble trying to figure out how much memory this application is using at certain critical points. She's an intermediate TP5 user, I'm an observer (!). How do you TP5 wizards check for memory in use (or, alternatively, free memory) at given points in your programs? We're looking for a way that we can generate such a report at arbitrary points in the source code (for the beta version, of course, not the finished product!), so we can see where a better approach to data handling might be warranted. Comments, suggestions, war stories, etc. all appreciated. Email unless you feel it's generally useful; I'm not sure how often this type of query arises. "Moby" Dick O'Connor Washington Department of Fisheries Olympia, Washington 98504 Internet Mail: djo7613@blake.acs.washington.edu **************************************************************************** DISCLAIMER: I speak only for myself, not for the Department. Here, anyway! **************************************************************************** So long, and thanks *from* all the fish...
granoff@vaxwrk.dec.com (Mark H. Granoff) (07/07/89)
In article <2662@blake.acs.washington.edu>, djo7613@blake.acs.washington.edu (Dick O'Connor) writes... >... How do you ... >check for memory in use (or, alternatively, free memory) at given >points in your programs? ... 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. Its all in the manual... or in the editor, type MemAvail or MaxAvail and press Ctrl/F1 for some brief help. ---------------------------------------------------------------------- Mark H. Granoff | Software Services/Engineering VAXworks Digital Equipment Corporation | ARPAnet: granoff@vaxwrk.dec.com 129 Parker Street | EASYnet: VAXWRK::GRANOFF PKO2-1/M21 | Usenet : ...!decwrl!vaxwrk!granoff Maynard, MA 01754 | AT&T : (508) 493-4512 ---------------------------------------------------------------------- Disclaimer: Views expressed herein are my own and do not necessarily reflect those of my employer. ----------------------------------------------------------------------
dmurdoch@watstat.waterloo.edu (Duncan Murdoch) (07/07/89)
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.
granoff@vaxwrk.dec.com (Mark H. Granoff) (07/10/89)
In article <290@maytag.waterloo.edu>, dmurdoch@watstat.waterloo.edu (Duncan Murdoch) writes... >In article <3405@shlump.dec.com> granoff@vaxwrk.dec.com (Mark H. Granoff) writes: >> [ my mistake deleted ] > >No, MaxAvail is the size of the largest contiguous area that's free. It's >never bigger than MemAvail. Oops. I didn't have a manual in front of me. I stand corrected. (Thanks!) ---------------------------------------------------------------------- Mark H. Granoff | Software Services/Engineering VAXworks Digital Equipment Corporation | ARPAnet: granoff@vaxwrk.dec.com 129 Parker Street | EASYnet: VAXWRK::GRANOFF PKO2-1/M21 | Usenet : ...!decwrl!vaxwrk!granoff Maynard, MA 01754 | AT&T : (508) 493-4512 ---------------------------------------------------------------------- Disclaimer: Views expressed herein are my own and do not necessarily reflect those of my employer. ----------------------------------------------------------------------