Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!samsung!usc!ucsd!helios.ee.lbl.gov!ux1.lbl.gov!beard From: beard@ux1.lbl.gov (Patrick C Beard) Newsgroups: comp.sys.mac.programmer Subject: Re: memTop, or how much RAM? Message-ID: <4531@helios.ee.lbl.gov> Date: 27 Dec 89 18:53:20 GMT References: <6885@tank.uchicago.edu> <6886@tank.uchicago.edu> Sender: usenet@helios.ee.lbl.gov Reply-To: beard@ux1.lbl.gov (Patrick C Beard) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 26 X-Local-Date: 27 Dec 89 10:53:20 PST In article <6886@tank.uchicago.edu> rfl@oddjob.uchicago.edu (Bob Loewenstein) writes: > >My last question may have been confusing..I need to know how much >Ram is installed in the machine. Occasionally my application interprets >a variable as pointer and before accessing memory perhaps pointed to, I >want to be sure that the "pointer" is pointing to a valid address. Well, the safest thing to do would probably check that the pointer points to a valid address in your OWN heap, or the System heap, and all other addresses aren't safe because they point to some other application's heap. However; you might for some reason wish to find out (if your were writing a utility that does diagnostics or whatever) the extent of physical RAM. I believe that the call MFTopMem gives you the address of the highest useable byte in memory. From the MPW interfaces: pascal Ptr MFTopMem(void) = {0x3F3C,0x0016,0xA88F}; This is available on all systems beyond 6.0. ------------------------------------------------------------------------------- - Patrick Beard, Macintosh Programmer (beard@lbl.gov) - - Berkeley Systems, Inc. "..............Good day!" - Paul Harvey - -------------------------------------------------------------------------------