tedj@hpcilzb.HP.COM (Ted Johnson) (03/10/88)
This is my second posting of the same question. I hope the reason that I got no response the first time was because everybody assumed that someone else would send me e-mail... What is the proper way to check for the total amount of RAM? Under 4.1/5.5 the following works: long totalRAM; totalRAM = (long)TopMem()/1024; But under MultiFinder this gives me too small a number (i.e., 179 instead of 1024). Any suggestions?!? Thanks! -Ted
saf@moss.ATT.COM (03/14/88)
This is not quite the answer to the question asked but it may be useful/helpful. I needed to know how much memory was available to my application both stand-alone and under MF. The following works (MPW C): THz save_my_zone; Size my_allotment; save_my_zone = GetZone(); SetZone(ApplicZone()); (void) MaxMem(&my_allotment); SetZone(save_my_zone); This sets "my_allotment" to the number of bytes available. Note that it only works if you are asking about the original application zone (or so says IM - I have not played with it extensively). Steve Falco moss!saf saf@moss.ATT.COM
goldman@Apple.COM (Phil Goldman) (03/14/88)
In article <730008@hpcilzb.HP.COM> tedj@hpcilzb.HP.COM (Ted Johnson) writes: > >What is the proper way to check for the total amount of >RAM? Under 4.1/5.5 the following works: > > long totalRAM; > > totalRAM = (long)TopMem()/1024; > >But under MultiFinder this gives me too small a number (i.e., 179 >instead of 1024). MultiFinder changes low memory variable MemTop (accesses by routine TopMem()) to a number *approximately* equal to the size of system heap + the size of the current (i.e. calling) application's partition. The rationale behind this is to "convince" older apps that this is the size of the machine. Note that this changes MemTop to be a size rather than a pointer; the 2 were equivalent before because RAM starts at 0, but most apps used it as a size. Hopefully an application does not need to know the real value of MemTop, or even a fake one, but if it does it should only need it for purposes of displaying machine information. Anyway...it seems that we were remiss in the first release of the MultiFinder Development Package. There *is* a MF temp memory call for MemTop, as follows: /* MultiFinder dispatch trap */ #define OSDISPATCH 0xA88F /* Routine selector value */ #define mfMemTopSel 22 /* Macro that the gets put into your source code */ #define MFMemTop() \ cTWMemTop(mfMemTopSel) /* And the actual trap that gets called */ pascal Ptr cMFMemTop(SW) short SW; extern OSDISPATCH; This info will be put in the MultiFinder documentation ASAP, along with the corresponding interfaces for Pascal and assembler. -Phil Goldman Apple Computer