BOOL TempMemSeemsLow(Size size) { BOOL seemsLow = TempFreeMem() < kTempMemSafetyMargin + size; if (seemsLow) { // Force a heap compaction, and look again. Size ignored = 0; TempMaxMem(&ignored); seemsLow = TempFreeMem() < kTempMemSafetyMargin + size; } return seemsLow; }
pascal void main (XCmdPtr paramPtr) { /* This XFCN returns the size of the largest block of system memory that's free. It should be the same number that's displayed as the "Largest Unused Block" by the Finder's "About this Macintosh" command. */ Str255 s; long growBytes; NumToString (TempMaxMem (&growBytes), s); paramPtr->returnValue = PasToZero (paramPtr, s); } /*main*/