#!/usr/local/bin/tclsh
source meminfo.tcl


proc doit {newkey} {
	global myarray

	# store a new value into the array
	set myarray($newkey) {}

	# clean out the array of older records.
	foreach {key} [array names myarray] {
		if {$key <= $newkey - 10} {
			unset myarray($key)
			#array unset myarray $key
		}
	}

}

while 1 {
	doit [incr i]

	if {$i % 5 == 0} {
		puts "myarray has currently [array size myarray] elements"
		meminfo
	}
}

