home *** CD-ROM | disk | FTP | other *** search
- /*
- ** MEMTEST - test the virtual memory system
- **
- ** Version 0.1 ⌐1990 by Edward Hutchins
- ** Authors:
- **
- ** Edward Hutchins: eah1@cec1.wustl.edu
- ** Loren Rittle: l-rittle@uiuc.edu
- **
- ** Revisions:
- ** 04/28/90 modified something - LJR.
- ** 12/19/91 code released as freeware under the GNU general public license - Ed.
- **
- ** This program is free software; you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation; either version 1, or (at your option)
- ** any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program; if not, write to the Free Software
- ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
- #include "vmem.h"
-
- #define TEST_SIZE 312500
-
- int main (int argc, char *argv[])
- {
- char ans[80];
- long *Mem;
- long lCnt;
-
- printf ("Allocating %d bytes of (FAST) memory ", TEST_SIZE*sizeof(long));
- if (!(Mem = (long *)AllocMem (TEST_SIZE*sizeof(long), 0)))
- {
- printf ("\nAllocMem failed!\n");
- exit (5);
- }
- printf ("at address: $%lx\n", Mem);
-
- printf ("Type 'q' <return> to quit, anything else to sweep.\n");
-
- while (strcmp ("q", gets (ans)) != 0)
- {
- printf ("Setting... ");
- for (lCnt = 0; lCnt < TEST_SIZE; ++lCnt) Mem[lCnt] = lCnt;
- printf ("Getting... ");
- for (lCnt = 0; lCnt < TEST_SIZE; lCnt += 2048)
- if (Mem[lCnt] != lCnt)
- {
- printf ("%d = %d\n", lCnt, Mem[lCnt] );
- }
- printf ("Done.\n");
- }
-
- printf ("Freeing memory\n");
- FreeMem (Mem, TEST_SIZE*sizeof(long));
- }
-