/test/language/gc/test_native_array_collector01.e

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