/* * MemPeek - peek Memory Manager handles * * April 16, 1995 * * by Michael Guitton * 3 rue de la Neustrie * Les Couets * 44340 BOUGUENAIS * France * * Sorry, no personal e-mail address. This is Postcardware (I like stamps too;). * */ #pragma keep "MemPeek" #pragma lint -1 #pragma optimize -1 #include #include #define BANKSE0E1 0x20000 /* Size in bytes of banks $E0 and $E1 */ #define TOTAL 12 /* Memory Manager defined Type IDs */ volatile Long * const firstHandle = (Long *) 0xE11600L; typedef struct HndlNode *HndlNodePtr; typedef struct HndlNode { Ptr locationPtr; Word attributes; Word userID; Long blockSize; HndlNodePtr lLink; HndlNodePtr rLink; } HndlNode; /* * $E0/0000..$E0/2000 = $2000 * $E0/C000..$E1/2000 = $6000 * $E1/C000..$E1/FFFF = $4000 * ----- * blockSize[ 0 ] = $C000 */ Long blockSize[ TOTAL ] = { 0xC000L }; Long RAMDiskSize = 0L; Long usedRAM = 0L; Long totalRAM; Long freeRAM; Long endOfRAM; HndlNodePtr theHandle; Byte index; void main( void ) { totalRAM = endOfRAM = TotalMem(); freeRAM = FreeMem(); endOfRAM -= BANKSE0E1; theHandle = (HndlNodePtr) *firstHandle; while ( theHandle != NULL ) { printf( "%06lX : %06lX %04X %04X %08lX %06lX %06lX\n", theHandle, theHandle->locationPtr, theHandle->attributes, theHandle->userID, theHandle->blockSize, theHandle->lLink, theHandle->rLink ); switch ( theHandle->userID ) { case 0x0000: if ( theHandle->attributes == (attrLocked | attrFixed) && theHandle->locationPtr >= (Ptr) endOfRAM ) break; if ( 0 ) /* skip 0x0001: if ( ... ) statement */ case 0x0001: if ( theHandle->attributes == attrNoSpec ) RAMDiskSize += theHandle->blockSize; /* let it go */ default: index = theHandle->userID >> 12; blockSize[ index < TOTAL ? index : TOTAL - 1 ] += theHandle->blockSize; break; } theHandle = theHandle->rLink; } for ( index = 0; index < TOTAL; index++) { printf( "Type %X = %4ldK\n", index, blockSize[ index ] >> 10 ); usedRAM += blockSize[ index ]; } printf( "RAMDisk = %4ldK\n", RAMDiskSize >> 10 ); printf( "Total RAM = %4ldK\n", totalRAM >> 10 ); printf( "Used RAM = %4ldK\n", (totalRAM - freeRAM) >> 10 ); printf( "Used RAM (2) = %4ldK\n", usedRAM >> 10 ); printf( "Free RAM = %4ldK\n", freeRAM >> 10 ); printf( "Real Free RAM = %4ldK\n", RealFreeMem() >> 10 ); }