Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

2.2 KiB

							    3/19/91

russbl


NT Clear Memory Utility



This is a utility for flushing the memory.


Program Structure & Theory of Operation
=======================================

The central routines are all in clearmem.c.

You will want to grab three routines:

FlushCache - Principle routine for cache flushing, just
calls the next two routines

AccesSection - Creates a 16 mbyte portion of virtual memory
and reads all of it. This uses all available
pages, causing the system cache to shrink to
its quota of 168 pages (672 k).

ReadFlushFile - Creates three files for flushing (FLUSH1,
FLUSH2, FLUSH3) if they do not exist in the
current directory. Each is 256 kb long.
Reads the three files into the cache, replacing
every page in the cache with pages from the
three files. The closes teh three files.

Currently CreateFile calls are made, since
OpenFile is not working at present.

Three files must be used since 256 kb is the
maximum the file systems will allow to be mapped
into the cache for any one file at any one time.

There are no global variables to worry about. However, error routines
in cmutl.c are called for diagnostic purposes. You will probably
wish to handle errors differently. The usage of these is trivial
to spot.

FLUSH.CSH is a kernel debugger output showing that the cache working
set is indeed filled with only records from the three files (mapped
to C1a......) when the operation is completed. (A write to the disk
is currently required to clear the cache completely of the three files
after they are closed. This is a bug in NT and will be fixed. In
FLUSH.CSH an mkdir is used to force this. This bug does not affect
the clearing of the cache by filling it with the three, which happens
regardless. This unimportant detail which may safely be ignored.)


Build Instructions:
===================

You may build clearmem.exe for test purposes.

1. cd \nt\private\sdktools\clearmem

2. build

The results will be in .\obj\i386. You want the clearmem.exe in
this directory.


*** END OF README ***