/[eiffelstudio]/trunk/eweasel/tests/runtime021/test.e
ViewVC logotype

Contents of /trunk/eweasel/tests/runtime021/test.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 101199 - (show annotations)
Sat Dec 23 19:12:44 2017 UTC (19 months, 4 weeks ago) by alexk
File size: 1306 byte(s)
Added an example that demonstrates a problem with code generation that may cause reattachments of expanded values to produce unexpected results because a copy of the expanded object might not be marked as reachable.
1 class TEST
2
3 inherit
4 MEMORY
5
6 create
7 make
8
9 feature {NONE} -- Creation
10
11 make
12 -- Run test.
13 local
14 y: detachable ANY
15 do
16 across
17 0 |..| 9 as i
18 loop
19 -- Attach an expanded value to a reference variable.
20 y := True
21 -- Make sure `Current` and `y` reach an old generation.
22 create_and_collect_garbage
23 -- Attach an old expanded object to a variable of an old object.
24 -- The new clone of `y` has to be reachable by GC.
25 x := y
26 -- Perform generational GC, so that `Current` (and the copy in `x`) is not processed
27 -- unless it has been registered by the assignment `x := y`.
28 create_and_collect_garbage
29 -- Report the value stored in `x` (presumably `True`).
30 check attached x as z then
31 io.put_integer (i.item)
32 io.put_string (": ")
33 print (z)
34 io.put_new_line
35 end
36 end
37 end
38
39 feature {NONE} -- Testing
40
41 x: detachable ANY
42 -- An attribute to be assigned an expanded value that should be tracked by GC.
43
44 create_and_collect_garbage
45 -- Create some new objects and then trigged a generational GC.
46 local
47 s: STRING
48 do
49 across
50 1 |..| 10 as j
51 loop
52 create s.make_empty
53 across
54 1 |..| 44 as i
55 loop
56 s.append ("sljkf shdjf hsdjf hjksd ds sd sdf dsf sdjgsd")
57 end
58 collect
59 end
60 end
61
62 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23