home *** CD-ROM | disk | FTP | other *** search
- {
- Malloc.pas - program to show all memory segments and their addresses.
- 03/09/87 MJC
- Copyright 1987 OSS
- Run this program at different times to see what is happening to
- free memory.
-
- compile for TOS
- }
- { DON'T tamper with this next line! }
- {$S1} { set startup routines to use only 1k of system mem for stack }
-
- Program Malloc;
-
- Const
-
- BlockSize = $ffffffff; { ffffffff hex is -1 Long }
-
- Var
-
- Address : Long_Integer; { address of mem block }
- Size : Long_Integer; { size of mem block }
- NoMore : Long_Integer;
- TTL : Long_Integer;
-
- Function Malloc( Size : Long_Integer ) : Long_Integer;
- Gemdos( $48 );
-
- Begin
- NoMore := 0;
- TTL := 0;
- writeln( 'Free Memory Segments -- Copyright 1987 OSS.' );
- writeln;
- writeln( 'Address Length' );
- writeln( '-------- --------' );
- Repeat
- Size := Malloc( BlockSize ); { find largest block size }
- IF ( Size <> NoMore ) THEN Begin
- TTL := TTL + Size;
- Address := Malloc( Size ); { get address of base }
- writeln( Address:8:h,' ', Size:8:h )
- end;
- Until ( Size = NoMore );
- writeln;
- writeln( 'Total Free Mem = ', TTL:8:h, ' or ', TTL, ' decimal.' );
- writeln;
- write( 'Press [RETURN] ' );
- readln;
- End.
-
- {EOF:MALLOC.PAS}
-