/test/language/gc/test_free2.e

http://github.com/tybor/Liberty · Specman e · 97 lines · 59 code · 5 blank · 33 comment · 0 complexity · 223ef693bd4db4985d0cac706245acdd MD5 · raw file

  1. -- This file is part of SmartEiffel The GNU Eiffel Compiler Tools and Libraries.
  2. -- See the Copyright notice at the end of this file.
  3. --
  4. class TEST_FREE2
  5. -- From philippe Coucaud <Philippe.Coucaud@telelogic.com>
  6. insert
  7. MEMORY
  8. create {}
  9. make
  10. feature {ANY}
  11. scale_factor: INTEGER 1
  12. -- 3
  13. -- 2
  14. -- 1 -> 38Mo
  15. make
  16. local
  17. d0, d1, d2: ARRAY[ARRAY[REAL_64]]; a: ARRAY[REAL_64]; i, j: INTEGER
  18. do
  19. from
  20. j := 200
  21. until
  22. j < 0
  23. loop
  24. -- allocate medium and big size RSOC
  25. from
  26. i := 30 * scale_factor
  27. create d0.make(1, 0)
  28. create d1.make(1, 0)
  29. until
  30. i < 1
  31. loop
  32. create a.make(0, 33777)
  33. -- requires a big chunk
  34. d0.add_last(a)
  35. create a.make(0, 2711) -- should fit in a 32K RSOC
  36. d1.add_last(a)
  37. i := i - 1
  38. end
  39. create d0.make(1, 0)
  40. -- forget previous d0
  41. -- allocate small and medium size RSOC
  42. from
  43. i := 40 * scale_factor
  44. create d1.make(1, 0)
  45. create d2.make(1, 0)
  46. until
  47. i < 1
  48. loop
  49. create a.make(0, 1971)
  50. -- should fit in a 32K RSOC
  51. d1.add_last(a)
  52. create a.make(0, 357)
  53. d2.add_last(a)
  54. i := i - 1
  55. end
  56. create d1.make(1, 0) -- forget previous d1
  57. create d2.make(1, 0)
  58. -- forget previous d2
  59. -- allocate big RSOC again
  60. from
  61. i := 30 * scale_factor
  62. create d0.make(1, 0)
  63. until
  64. i < 1
  65. loop
  66. create a.make(0, 35001)
  67. -- should fit in a 32K RSOC
  68. d0.add_last(a)
  69. i := i - 1
  70. end
  71. j := j - 1
  72. end
  73. end
  74. end -- class TEST_FREE2
  75. --
  76. -- ------------------------------------------------------------------------------------------------------------------------------
  77. -- Copyright notice below. Please read.
  78. --
  79. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  80. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  81. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  82. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  83. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  84. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  85. --
  86. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  87. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  88. --
  89. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  90. --
  91. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  92. -- ------------------------------------------------------------------------------------------------------------------------------