/test/language/gc/test_native_array_collector03.e

http://github.com/tybor/Liberty · Specman e · 81 lines · 49 code · 10 blank · 22 comment · 2 complexity · 07d8ee1d5d4d391c0c2e1d601f29e20f 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_NATIVE_ARRAY_COLLECTOR03
  5. insert
  6. EIFFELTEST_TOOLS
  7. NATIVE_ARRAY_COLLECTOR[STRING]
  8. create {}
  9. make
  10. feature {ANY}
  11. make
  12. do
  13. capacity := 1
  14. honeypot := honeypot.calloc(capacity)
  15. full_collect
  16. assert(flag)
  17. assert(not reentering)
  18. end
  19. mark_native_arrays
  20. do
  21. reentering := reentering or else in_mark
  22. if not in_mark then
  23. -- To avoid screwing up the test suite
  24. in_mark := True
  25. full_collect -- Don't do this at home kids
  26. flag := True
  27. in_mark := False
  28. end
  29. end
  30. flag, reentering, in_mark: BOOLEAN
  31. capacity: INTEGER
  32. honeypot: NATIVE_ARRAY[STRING]
  33. full_collect
  34. local
  35. m: MEMORY
  36. do
  37. generate_garbage
  38. m.full_collect
  39. end
  40. generate_garbage
  41. local
  42. i: INTEGER; s: STRING
  43. do
  44. from
  45. i := 1
  46. until
  47. i = 10000
  48. loop
  49. create s.make_from_string("quark ends here")
  50. i := i + 1
  51. end
  52. end
  53. end -- class TEST_NATIVE_ARRAY_COLLECTOR03
  54. --
  55. -- ------------------------------------------------------------------------------------------------------------------------------
  56. -- Copyright notice below. Please read.
  57. --
  58. -- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
  59. -- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
  60. -- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
  61. -- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
  62. -- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
  63. -- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  64. --
  65. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  66. -- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  67. --
  68. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  69. --
  70. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  71. -- ------------------------------------------------------------------------------------------------------------------------------