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

  1. proc CreateHugeArray1 {} {
  2. global Array1
  3. for {set i 0} {$i < 500000} {incr i} {
  4. set Array1("string_$i") "This is the value with key $i"
  5. }
  6. }
  7.  
  8. proc CreateHugeArray2 {} {
  9. global Array2
  10. for {set i 0} {$i < 500000} {incr i} {
  11. set Array2("string_$i") "This is the value with key $i"
  12. }
  13. }
  14.  
  15. proc CreateHugeArray3 {} {
  16. global Array3
  17. for {set i 0} {$i < 500000} {incr i} {
  18. set Array3("string_$i") "This is the value with key $i"
  19. }
  20. }
  21.  
  22. proc CreateHugeArray4 {} {
  23. global Array4
  24. for {set i 0} {$i < 500000} {incr i} {
  25. set Array4("string_$i") "This is the value with key $i"
  26. }
  27. }
  28.  
  29. proc CreateHugeArray5 {} {
  30. global Array5
  31. for {set i 0} {$i < 500000} {incr i} {
  32. set Array5("string_$i") "This is the value with key $i"
  33. }
  34. }
  35.  
  36.  
  37. puts "Filling array 1..."
  38. CreateHugeArray1
  39. puts "Done. Press any return to continue..."
  40. gets stdin
  41. puts "Filling array 2..."
  42. CreateHugeArray2
  43. puts "Done. Press any return to continue..."
  44. gets stdin
  45. puts "Filling array 3..."
  46. CreateHugeArray3
  47. puts "Done. Press any return to continue..."
  48. gets stdin
  49. puts "Filling array 4..."
  50. CreateHugeArray4
  51. puts "Done. Press any return to continue..."
  52. gets stdin
  53. puts "Filling array 5..."
  54. CreateHugeArray5
  55. puts "Done. Press any return to continue..."
  56. gets stdin
  57.  
  58. puts "Arrays exists - 1: [array exists Array1] | 2: [array exists Array2] | 3: [array exists Array3] | 4: [array exists Array3] | 5: [array exists Array3]"
  59.  
  60. puts "Unsetting array..."
  61.  
  62. unset Array1
  63. unset Array2
  64. unset Array3
  65. unset Array4
  66. unset Array5
  67.  
  68. puts "Arrays exists - 2: [array exists Array1] | 2: [array exists Array2] | 3: [array exists Array3] | 4: [array exists Array3] | 5: [array exists Array3]"
  69.  
  70. puts "Done. Press any return to exit..."
  71. gets stdin
  72. exit