Posted to tcl by Toen at Sun Mar 04 07:47:48 GMT 2018view pretty

proc CreateHugeArray1 {} {
  global Array1
  for {set i 0} {$i < 500000} {incr i} {
    set Array1("string_$i") "This is the value with key $i"
  }
}

proc CreateHugeArray2 {} {
  global Array2
  for {set i 0} {$i < 500000} {incr i} {
    set Array2("string_$i") "This is the value with key $i"
  }
}

proc CreateHugeArray3 {} {
  global Array3
  for {set i 0} {$i < 500000} {incr i} {
    set Array3("string_$i") "This is the value with key $i"
  }
}

proc CreateHugeArray4 {} {
  global Array4
  for {set i 0} {$i < 500000} {incr i} {
    set Array4("string_$i") "This is the value with key $i"
  }
}

proc CreateHugeArray5 {} {
  global Array5
  for {set i 0} {$i < 500000} {incr i} {
    set Array5("string_$i") "This is the value with key $i"
  }
}


puts "Filling array 1..."
CreateHugeArray1
puts "Done. Press any return to continue..."
gets stdin
puts "Filling array 2..."
CreateHugeArray2
puts "Done. Press any return to continue..."
gets stdin
puts "Filling array 3..."
CreateHugeArray3
puts "Done. Press any return to continue..."
gets stdin
puts "Filling array 4..."
CreateHugeArray4
puts "Done. Press any return to continue..."
gets stdin
puts "Filling array 5..."
CreateHugeArray5
puts "Done. Press any return to continue..."
gets stdin

puts "Arrays exists - 1: [array exists Array1] | 2: [array exists Array2] | 3: [array exists Array3] | 4: [array exists Array3] | 5: [array exists Array3]"

puts "Unsetting array..."

unset Array1
unset Array2
unset Array3
unset Array4
unset Array5

puts "Arrays exists - 2: [array exists Array1] | 2: [array exists Array2] | 3: [array exists Array3] | 4: [array exists Array3] | 5: [array exists Array3]"

puts "Done. Press any return to exit..."
gets stdin
exit