ref 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. data/README.rdoc +35 -0
  2. data/VERSION +1 -0
  3. data/ext/java/org/jruby/ext/ref/ReferencesService.java +28 -0
  4. data/ext/java/org/jruby/ext/ref/RubySoftReference.java +43 -0
  5. data/ext/java/org/jruby/ext/ref/RubyWeakReference.java +43 -0
  6. data/lib/org/jruby/ext/ref/references.jar +0 -0
  7. data/lib/ref.rb +39 -0
  8. data/lib/ref/abstract_reference_key_map.rb +117 -0
  9. data/lib/ref/abstract_reference_value_map.rb +127 -0
  10. data/lib/ref/mock.rb +145 -0
  11. data/lib/ref/reference.rb +24 -0
  12. data/lib/ref/reference_queue.rb +89 -0
  13. data/lib/ref/safe_monitor.rb +50 -0
  14. data/lib/ref/soft_key_map.rb +26 -0
  15. data/lib/ref/soft_reference.rb +67 -0
  16. data/lib/ref/soft_value_map.rb +28 -0
  17. data/lib/ref/strong_reference.rb +17 -0
  18. data/lib/ref/weak_key_map.rb +26 -0
  19. data/lib/ref/weak_reference.rb +26 -0
  20. data/lib/ref/weak_reference/iron_ruby.rb +14 -0
  21. data/lib/ref/weak_reference/pure_ruby.rb +91 -0
  22. data/lib/ref/weak_reference/weak_ref.rb +23 -0
  23. data/lib/ref/weak_value_map.rb +27 -0
  24. data/test/reference_key_map_behavior.rb +157 -0
  25. data/test/reference_key_map_behavior.rbc +4296 -0
  26. data/test/reference_queue_test.rb +60 -0
  27. data/test/reference_queue_test.rbc +1954 -0
  28. data/test/reference_value_map_behavior.rb +137 -0
  29. data/test/reference_value_map_behavior.rbc +3615 -0
  30. data/test/soft_key_map_test.rb +13 -0
  31. data/test/soft_key_map_test.rbc +374 -0
  32. data/test/soft_reference_test.rb +49 -0
  33. data/test/soft_reference_test.rbc +1481 -0
  34. data/test/soft_value_map_test.rb +13 -0
  35. data/test/soft_value_map_test.rbc +374 -0
  36. data/test/strong_reference_test.rb +15 -0
  37. data/test/strong_reference_test.rbc +562 -0
  38. data/test/test_helper.rb +4 -0
  39. data/test/weak_key_map_test.rb +13 -0
  40. data/test/weak_key_map_test.rbc +374 -0
  41. data/test/weak_reference_test.rb +46 -0
  42. data/test/weak_reference_test.rbc +1254 -0
  43. data/test/weak_value_map_test.rb +13 -0
  44. data/test/weak_value_map_test.rbc +374 -0
  45. metadata +113 -0
@@ -0,0 +1,13 @@
1
+ require File.expand_path("../test_helper", __FILE__)
2
+
3
+ class TestSoftKeyMap < Test::Unit::TestCase
4
+ include ReferenceKeyMapBehavior
5
+
6
+ def map_class
7
+ Ref::SoftKeyMap
8
+ end
9
+
10
+ def reference_class
11
+ Ref::SoftReference
12
+ end
13
+ end
@@ -0,0 +1,374 @@
1
+ !RBIX
2
+ 0
3
+ x
4
+ M
5
+ 1
6
+ n
7
+ n
8
+ x
9
+ 10
10
+ __script__
11
+ i
12
+ 82
13
+ 5
14
+ 7
15
+ 0
16
+ 64
17
+ 47
18
+ 49
19
+ 1
20
+ 1
21
+ 15
22
+ 5
23
+ 45
24
+ 2
25
+ 3
26
+ 7
27
+ 4
28
+ 64
29
+ 65
30
+ 49
31
+ 5
32
+ 0
33
+ 49
34
+ 6
35
+ 2
36
+ 47
37
+ 49
38
+ 1
39
+ 1
40
+ 15
41
+ 5
42
+ 45
43
+ 2
44
+ 7
45
+ 7
46
+ 8
47
+ 64
48
+ 65
49
+ 49
50
+ 5
51
+ 0
52
+ 49
53
+ 6
54
+ 2
55
+ 47
56
+ 49
57
+ 1
58
+ 1
59
+ 15
60
+ 99
61
+ 7
62
+ 9
63
+ 45
64
+ 10
65
+ 11
66
+ 43
67
+ 12
68
+ 43
69
+ 13
70
+ 65
71
+ 49
72
+ 14
73
+ 3
74
+ 13
75
+ 99
76
+ 12
77
+ 7
78
+ 15
79
+ 12
80
+ 7
81
+ 16
82
+ 12
83
+ 65
84
+ 12
85
+ 49
86
+ 17
87
+ 4
88
+ 15
89
+ 49
90
+ 15
91
+ 0
92
+ 15
93
+ 2
94
+ 11
95
+ I
96
+ 6
97
+ I
98
+ 0
99
+ I
100
+ 0
101
+ I
102
+ 0
103
+ n
104
+ p
105
+ 18
106
+ s
107
+ 9
108
+ test/unit
109
+ x
110
+ 7
111
+ require
112
+ x
113
+ 4
114
+ File
115
+ n
116
+ s
117
+ 13
118
+ ../../lib/ref
119
+ x
120
+ 11
121
+ active_path
122
+ x
123
+ 11
124
+ expand_path
125
+ n
126
+ s
127
+ 29
128
+ ../reference_key_map_behavior
129
+ x
130
+ 14
131
+ TestSoftKeyMap
132
+ x
133
+ 4
134
+ Test
135
+ n
136
+ x
137
+ 4
138
+ Unit
139
+ x
140
+ 8
141
+ TestCase
142
+ x
143
+ 10
144
+ open_class
145
+ x
146
+ 14
147
+ __class_init__
148
+ M
149
+ 1
150
+ n
151
+ n
152
+ x
153
+ 14
154
+ TestSoftKeyMap
155
+ i
156
+ 39
157
+ 5
158
+ 66
159
+ 5
160
+ 45
161
+ 0
162
+ 1
163
+ 47
164
+ 49
165
+ 2
166
+ 1
167
+ 15
168
+ 99
169
+ 7
170
+ 3
171
+ 7
172
+ 4
173
+ 65
174
+ 67
175
+ 49
176
+ 5
177
+ 0
178
+ 49
179
+ 6
180
+ 4
181
+ 15
182
+ 99
183
+ 7
184
+ 7
185
+ 7
186
+ 8
187
+ 65
188
+ 67
189
+ 49
190
+ 5
191
+ 0
192
+ 49
193
+ 6
194
+ 4
195
+ 11
196
+ I
197
+ 5
198
+ I
199
+ 0
200
+ I
201
+ 0
202
+ I
203
+ 0
204
+ n
205
+ p
206
+ 9
207
+ x
208
+ 23
209
+ ReferenceKeyMapBehavior
210
+ n
211
+ x
212
+ 7
213
+ include
214
+ x
215
+ 9
216
+ map_class
217
+ M
218
+ 1
219
+ n
220
+ n
221
+ x
222
+ 9
223
+ map_class
224
+ i
225
+ 6
226
+ 45
227
+ 0
228
+ 1
229
+ 43
230
+ 2
231
+ 11
232
+ I
233
+ 1
234
+ I
235
+ 0
236
+ I
237
+ 0
238
+ I
239
+ 0
240
+ n
241
+ p
242
+ 3
243
+ x
244
+ 3
245
+ Ref
246
+ n
247
+ x
248
+ 10
249
+ SoftKeyMap
250
+ p
251
+ 5
252
+ I
253
+ -1
254
+ I
255
+ 8
256
+ I
257
+ 0
258
+ I
259
+ 9
260
+ I
261
+ 6
262
+ x
263
+ 57
264
+ /Users/bdurand/dev/projects/ref/test/soft_key_map_test.rb
265
+ p
266
+ 0
267
+ x
268
+ 17
269
+ method_visibility
270
+ x
271
+ 15
272
+ add_defn_method
273
+ x
274
+ 15
275
+ reference_class
276
+ M
277
+ 1
278
+ n
279
+ n
280
+ x
281
+ 15
282
+ reference_class
283
+ i
284
+ 6
285
+ 45
286
+ 0
287
+ 1
288
+ 43
289
+ 2
290
+ 11
291
+ I
292
+ 1
293
+ I
294
+ 0
295
+ I
296
+ 0
297
+ I
298
+ 0
299
+ n
300
+ p
301
+ 3
302
+ x
303
+ 3
304
+ Ref
305
+ n
306
+ x
307
+ 13
308
+ SoftReference
309
+ p
310
+ 5
311
+ I
312
+ -1
313
+ I
314
+ c
315
+ I
316
+ 0
317
+ I
318
+ d
319
+ I
320
+ 6
321
+ x
322
+ 57
323
+ /Users/bdurand/dev/projects/ref/test/soft_key_map_test.rb
324
+ p
325
+ 0
326
+ p
327
+ 7
328
+ I
329
+ 2
330
+ I
331
+ 6
332
+ I
333
+ b
334
+ I
335
+ 8
336
+ I
337
+ 19
338
+ I
339
+ c
340
+ I
341
+ 27
342
+ x
343
+ 57
344
+ /Users/bdurand/dev/projects/ref/test/soft_key_map_test.rb
345
+ p
346
+ 0
347
+ x
348
+ 13
349
+ attach_method
350
+ p
351
+ 9
352
+ I
353
+ 0
354
+ I
355
+ 1
356
+ I
357
+ 9
358
+ I
359
+ 2
360
+ I
361
+ 1c
362
+ I
363
+ 3
364
+ I
365
+ 2f
366
+ I
367
+ 5
368
+ I
369
+ 52
370
+ x
371
+ 57
372
+ /Users/bdurand/dev/projects/ref/test/soft_key_map_test.rb
373
+ p
374
+ 0
@@ -0,0 +1,49 @@
1
+ require File.expand_path("../test_helper", __FILE__)
2
+
3
+ class TestSoftReference < Test::Unit::TestCase
4
+ def test_can_get_non_garbage_collected_objects
5
+ obj = Object.new
6
+ ref = Ref::SoftReference.new(obj)
7
+ assert_equal obj, ref.object
8
+ assert_equal obj.object_id, ref.referenced_object_id
9
+ end
10
+
11
+ def test_get_the_correct_object
12
+ # Since we can't reliably control the garbage collector, this is a brute force test.
13
+ # It might not always fail if the garbage collector and memory allocator don't
14
+ # cooperate, but it should fail often enough on continuous integration to
15
+ # hilite any problems. Set the environment variable QUICK_TEST to "true" if you
16
+ # want to make the tests run quickly.
17
+ id_to_ref = {}
18
+ (ENV["QUICK_TEST"] == "true" ? 1000 : 100000).times do |i|
19
+ obj = Object.new
20
+ if id_to_ref.key?(obj.object_id)
21
+ ref = id_to_ref[obj.object_id]
22
+ if ref.object
23
+ flunk "soft reference found with a live reference to an object that was not the one it was created with"
24
+ break
25
+ end
26
+ end
27
+ %w(Here are a bunch of objects that are allocated and can then be cleaned up by the garbage collector)
28
+ id_to_ref[obj.object_id] = Ref::SoftReference.new(obj)
29
+ if i % 1000 == 0
30
+ GC.start
31
+ sleep(0.01)
32
+ end
33
+ end
34
+ end
35
+
36
+ def test_references_are_not_collected_immediately
37
+ ref = Ref::SoftReference.new(Object.new)
38
+ 9.times{arr = %w(allocate some memory on the heap); arr *= 100; GC.start}
39
+ assert ref.object
40
+ end
41
+
42
+ def test_inspect
43
+ ref = Ref::SoftReference.new(Object.new)
44
+ assert ref.inspect
45
+ GC.start
46
+ GC.start
47
+ assert ref.inspect
48
+ end
49
+ end
@@ -0,0 +1,1481 @@
1
+ !RBIX
2
+ 0
3
+ x
4
+ M
5
+ 1
6
+ n
7
+ n
8
+ x
9
+ 10
10
+ __script__
11
+ i
12
+ 63
13
+ 5
14
+ 7
15
+ 0
16
+ 64
17
+ 47
18
+ 49
19
+ 1
20
+ 1
21
+ 15
22
+ 5
23
+ 45
24
+ 2
25
+ 3
26
+ 7
27
+ 4
28
+ 64
29
+ 65
30
+ 49
31
+ 5
32
+ 0
33
+ 49
34
+ 6
35
+ 2
36
+ 47
37
+ 49
38
+ 1
39
+ 1
40
+ 15
41
+ 99
42
+ 7
43
+ 7
44
+ 45
45
+ 8
46
+ 9
47
+ 43
48
+ 10
49
+ 43
50
+ 11
51
+ 65
52
+ 49
53
+ 12
54
+ 3
55
+ 13
56
+ 99
57
+ 12
58
+ 7
59
+ 13
60
+ 12
61
+ 7
62
+ 14
63
+ 12
64
+ 65
65
+ 12
66
+ 49
67
+ 15
68
+ 4
69
+ 15
70
+ 49
71
+ 13
72
+ 0
73
+ 15
74
+ 2
75
+ 11
76
+ I
77
+ 6
78
+ I
79
+ 0
80
+ I
81
+ 0
82
+ I
83
+ 0
84
+ n
85
+ p
86
+ 16
87
+ s
88
+ 9
89
+ test/unit
90
+ x
91
+ 7
92
+ require
93
+ x
94
+ 4
95
+ File
96
+ n
97
+ s
98
+ 13
99
+ ../../lib/ref
100
+ x
101
+ 11
102
+ active_path
103
+ x
104
+ 11
105
+ expand_path
106
+ x
107
+ 17
108
+ TestSoftReference
109
+ x
110
+ 4
111
+ Test
112
+ n
113
+ x
114
+ 4
115
+ Unit
116
+ x
117
+ 8
118
+ TestCase
119
+ x
120
+ 10
121
+ open_class
122
+ x
123
+ 14
124
+ __class_init__
125
+ M
126
+ 1
127
+ n
128
+ n
129
+ x
130
+ 17
131
+ TestSoftReference
132
+ i
133
+ 58
134
+ 5
135
+ 66
136
+ 99
137
+ 7
138
+ 0
139
+ 7
140
+ 1
141
+ 65
142
+ 67
143
+ 49
144
+ 2
145
+ 0
146
+ 49
147
+ 3
148
+ 4
149
+ 15
150
+ 99
151
+ 7
152
+ 4
153
+ 7
154
+ 5
155
+ 65
156
+ 67
157
+ 49
158
+ 2
159
+ 0
160
+ 49
161
+ 3
162
+ 4
163
+ 15
164
+ 99
165
+ 7
166
+ 6
167
+ 7
168
+ 7
169
+ 65
170
+ 67
171
+ 49
172
+ 2
173
+ 0
174
+ 49
175
+ 3
176
+ 4
177
+ 15
178
+ 99
179
+ 7
180
+ 8
181
+ 7
182
+ 9
183
+ 65
184
+ 67
185
+ 49
186
+ 2
187
+ 0
188
+ 49
189
+ 3
190
+ 4
191
+ 11
192
+ I
193
+ 5
194
+ I
195
+ 0
196
+ I
197
+ 0
198
+ I
199
+ 0
200
+ n
201
+ p
202
+ 10
203
+ x
204
+ 42
205
+ test_can_get_non_garbage_collected_objects
206
+ M
207
+ 1
208
+ n
209
+ n
210
+ x
211
+ 42
212
+ test_can_get_non_garbage_collected_objects
213
+ i
214
+ 89
215
+ 45
216
+ 0
217
+ 1
218
+ 13
219
+ 71
220
+ 2
221
+ 47
222
+ 9
223
+ 21
224
+ 47
225
+ 49
226
+ 3
227
+ 0
228
+ 13
229
+ 47
230
+ 49
231
+ 4
232
+ 0
233
+ 15
234
+ 8
235
+ 24
236
+ 49
237
+ 2
238
+ 0
239
+ 19
240
+ 0
241
+ 15
242
+ 45
243
+ 5
244
+ 6
245
+ 43
246
+ 7
247
+ 13
248
+ 71
249
+ 2
250
+ 47
251
+ 9
252
+ 52
253
+ 47
254
+ 49
255
+ 3
256
+ 0
257
+ 13
258
+ 20
259
+ 0
260
+ 47
261
+ 49
262
+ 4
263
+ 1
264
+ 15
265
+ 8
266
+ 57
267
+ 20
268
+ 0
269
+ 49
270
+ 2
271
+ 1
272
+ 19
273
+ 1
274
+ 15
275
+ 5
276
+ 20
277
+ 0
278
+ 20
279
+ 1
280
+ 49
281
+ 8
282
+ 0
283
+ 47
284
+ 49
285
+ 9
286
+ 2
287
+ 15
288
+ 5
289
+ 20
290
+ 0
291
+ 49
292
+ 10
293
+ 0
294
+ 20
295
+ 1
296
+ 49
297
+ 11
298
+ 0
299
+ 47
300
+ 49
301
+ 9
302
+ 2
303
+ 11
304
+ I
305
+ 5
306
+ I
307
+ 2
308
+ I
309
+ 0
310
+ I
311
+ 0
312
+ n
313
+ p
314
+ 12
315
+ x
316
+ 6
317
+ Object
318
+ n
319
+ x
320
+ 3
321
+ new
322
+ x
323
+ 8
324
+ allocate
325
+ x
326
+ 10
327
+ initialize
328
+ x
329
+ 3
330
+ Ref
331
+ n
332
+ x
333
+ 13
334
+ SoftReference
335
+ x
336
+ 6
337
+ object
338
+ x
339
+ 12
340
+ assert_equal
341
+ x
342
+ 9
343
+ object_id
344
+ x
345
+ 20
346
+ referenced_object_id
347
+ p
348
+ 11
349
+ I
350
+ -1
351
+ I
352
+ 5
353
+ I
354
+ 0
355
+ I
356
+ 6
357
+ I
358
+ 1b
359
+ I
360
+ 7
361
+ I
362
+ 3c
363
+ I
364
+ 8
365
+ I
366
+ 49
367
+ I
368
+ 9
369
+ I
370
+ 59
371
+ x
372
+ 59
373
+ /Users/bdurand/dev/projects/ref/test/soft_reference_test.rb
374
+ p
375
+ 2
376
+ x
377
+ 3
378
+ obj
379
+ x
380
+ 3
381
+ ref
382
+ x
383
+ 17
384
+ method_visibility
385
+ x
386
+ 15
387
+ add_defn_method
388
+ x
389
+ 27
390
+ test_get_the_correct_object
391
+ M
392
+ 1
393
+ n
394
+ n
395
+ x
396
+ 27
397
+ test_get_the_correct_object
398
+ i
399
+ 38
400
+ 44
401
+ 43
402
+ 0
403
+ 78
404
+ 49
405
+ 1
406
+ 1
407
+ 19
408
+ 0
409
+ 15
410
+ 45
411
+ 2
412
+ 3
413
+ 7
414
+ 4
415
+ 64
416
+ 49
417
+ 5
418
+ 1
419
+ 7
420
+ 6
421
+ 64
422
+ 83
423
+ 7
424
+ 9
425
+ 30
426
+ 7
427
+ 8
428
+ 8
429
+ 32
430
+ 7
431
+ 9
432
+ 56
433
+ 10
434
+ 50
435
+ 11
436
+ 0
437
+ 11
438
+ I
439
+ 3
440
+ I
441
+ 1
442
+ I
443
+ 0
444
+ I
445
+ 0
446
+ n
447
+ p
448
+ 12
449
+ x
450
+ 4
451
+ Hash
452
+ x
453
+ 16
454
+ new_from_literal
455
+ x
456
+ 3
457
+ ENV
458
+ n
459
+ s
460
+ 10
461
+ QUICK_TEST
462
+ x
463
+ 2
464
+ []
465
+ s
466
+ 4
467
+ true
468
+ x
469
+ 2
470
+ ==
471
+ I
472
+ 3e8
473
+ I
474
+ 186a0
475
+ M
476
+ 1
477
+ p
478
+ 2
479
+ x
480
+ 9
481
+ for_block
482
+ t
483
+ n
484
+ x
485
+ 27
486
+ test_get_the_correct_object
487
+ i
488
+ 219
489
+ 57
490
+ 19
491
+ 0
492
+ 15
493
+ 45
494
+ 0
495
+ 1
496
+ 13
497
+ 71
498
+ 2
499
+ 47
500
+ 9
501
+ 25
502
+ 47
503
+ 49
504
+ 3
505
+ 0
506
+ 13
507
+ 47
508
+ 49
509
+ 4
510
+ 0
511
+ 15
512
+ 8
513
+ 28
514
+ 49
515
+ 2
516
+ 0
517
+ 19
518
+ 1
519
+ 15
520
+ 21
521
+ 1
522
+ 0
523
+ 20
524
+ 1
525
+ 49
526
+ 5
527
+ 0
528
+ 49
529
+ 6
530
+ 1
531
+ 9
532
+ 81
533
+ 21
534
+ 1
535
+ 0
536
+ 20
537
+ 1
538
+ 49
539
+ 5
540
+ 0
541
+ 49
542
+ 7
543
+ 1
544
+ 19
545
+ 2
546
+ 15
547
+ 20
548
+ 2
549
+ 49
550
+ 8
551
+ 0
552
+ 9
553
+ 78
554
+ 5
555
+ 7
556
+ 9
557
+ 64
558
+ 47
559
+ 49
560
+ 10
561
+ 1
562
+ 15
563
+ 1
564
+ 33
565
+ 8
566
+ 79
567
+ 1
568
+ 8
569
+ 82
570
+ 1
571
+ 15
572
+ 7
573
+ 11
574
+ 64
575
+ 7
576
+ 12
577
+ 64
578
+ 7
579
+ 13
580
+ 64
581
+ 7
582
+ 14
583
+ 64
584
+ 7
585
+ 15
586
+ 64
587
+ 7
588
+ 16
589
+ 64
590
+ 7
591
+ 17
592
+ 64
593
+ 7
594
+ 12
595
+ 64
596
+ 7
597
+ 18
598
+ 64
599
+ 7
600
+ 19
601
+ 64
602
+ 7
603
+ 20
604
+ 64
605
+ 7
606
+ 21
607
+ 64
608
+ 7
609
+ 22
610
+ 64
611
+ 7
612
+ 23
613
+ 64
614
+ 7
615
+ 24
616
+ 64
617
+ 7
618
+ 25
619
+ 64
620
+ 7
621
+ 26
622
+ 64
623
+ 7
624
+ 27
625
+ 64
626
+ 7
627
+ 28
628
+ 64
629
+ 35
630
+ 19
631
+ 15
632
+ 21
633
+ 1
634
+ 0
635
+ 20
636
+ 1
637
+ 49
638
+ 5
639
+ 0
640
+ 45
641
+ 29
642
+ 30
643
+ 43
644
+ 31
645
+ 13
646
+ 71
647
+ 2
648
+ 47
649
+ 9
650
+ 176
651
+ 47
652
+ 49
653
+ 3
654
+ 0
655
+ 13
656
+ 20
657
+ 1
658
+ 47
659
+ 49
660
+ 4
661
+ 1
662
+ 15
663
+ 8
664
+ 181
665
+ 20
666
+ 1
667
+ 49
668
+ 2
669
+ 1
670
+ 13
671
+ 18
672
+ 3
673
+ 49
674
+ 32
675
+ 2
676
+ 15
677
+ 15
678
+ 20
679
+ 0
680
+ 7
681
+ 33
682
+ 49
683
+ 34
684
+ 1
685
+ 78
686
+ 83
687
+ 35
688
+ 9
689
+ 217
690
+ 45
691
+ 36
692
+ 37
693
+ 49
694
+ 38
695
+ 0
696
+ 15
697
+ 5
698
+ 7
699
+ 39
700
+ 47
701
+ 49
702
+ 40
703
+ 1
704
+ 8
705
+ 218
706
+ 1
707
+ 11
708
+ I
709
+ 17
710
+ I
711
+ 3
712
+ I
713
+ 1
714
+ I
715
+ 1
716
+ n
717
+ p
718
+ 41
719
+ x
720
+ 6
721
+ Object
722
+ n
723
+ x
724
+ 3
725
+ new
726
+ x
727
+ 8
728
+ allocate
729
+ x
730
+ 10
731
+ initialize
732
+ x
733
+ 9
734
+ object_id
735
+ x
736
+ 4
737
+ key?
738
+ x
739
+ 2
740
+ []
741
+ x
742
+ 6
743
+ object
744
+ s
745
+ 96
746
+ soft reference found with a live reference to an object that was not the one it was created with
747
+ x
748
+ 5
749
+ flunk
750
+ s
751
+ 4
752
+ Here
753
+ s
754
+ 3
755
+ are
756
+ s
757
+ 1
758
+ a
759
+ s
760
+ 5
761
+ bunch
762
+ s
763
+ 2
764
+ of
765
+ s
766
+ 7
767
+ objects
768
+ s
769
+ 4
770
+ that
771
+ s
772
+ 9
773
+ allocated
774
+ s
775
+ 3
776
+ and
777
+ s
778
+ 3
779
+ can
780
+ s
781
+ 4
782
+ then
783
+ s
784
+ 2
785
+ be
786
+ s
787
+ 7
788
+ cleaned
789
+ s
790
+ 2
791
+ up
792
+ s
793
+ 2
794
+ by
795
+ s
796
+ 3
797
+ the
798
+ s
799
+ 7
800
+ garbage
801
+ s
802
+ 9
803
+ collector
804
+ x
805
+ 3
806
+ Ref
807
+ n
808
+ x
809
+ 13
810
+ SoftReference
811
+ x
812
+ 3
813
+ []=
814
+ I
815
+ 3e8
816
+ x
817
+ 1
818
+ %
819
+ x
820
+ 2
821
+ ==
822
+ x
823
+ 2
824
+ GC
825
+ n
826
+ x
827
+ 5
828
+ start
829
+ d
830
+ +0.640000000000000013322676295501878485083580017089843750 -6
831
+ x
832
+ 5
833
+ sleep
834
+ p
835
+ 31
836
+ I
837
+ 0
838
+ I
839
+ 13
840
+ I
841
+ 4
842
+ I
843
+ 14
844
+ I
845
+ 1f
846
+ I
847
+ 15
848
+ I
849
+ 2c
850
+ I
851
+ 16
852
+ I
853
+ 3a
854
+ I
855
+ 17
856
+ I
857
+ 41
858
+ I
859
+ 18
860
+ I
861
+ 4a
862
+ I
863
+ 19
864
+ I
865
+ 4e
866
+ I
867
+ 17
868
+ I
869
+ 51
870
+ I
871
+ 15
872
+ I
873
+ 53
874
+ I
875
+ 1c
876
+ I
877
+ 8f
878
+ I
879
+ 1d
880
+ I
881
+ bd
882
+ I
883
+ 1e
884
+ I
885
+ c9
886
+ I
887
+ 1f
888
+ I
889
+ d0
890
+ I
891
+ 20
892
+ I
893
+ d9
894
+ I
895
+ 1e
896
+ I
897
+ db
898
+ x
899
+ 59
900
+ /Users/bdurand/dev/projects/ref/test/soft_reference_test.rb
901
+ p
902
+ 3
903
+ x
904
+ 1
905
+ i
906
+ x
907
+ 3
908
+ obj
909
+ x
910
+ 3
911
+ ref
912
+ x
913
+ 5
914
+ times
915
+ p
916
+ 7
917
+ I
918
+ -1
919
+ I
920
+ c
921
+ I
922
+ 0
923
+ I
924
+ 12
925
+ I
926
+ a
927
+ I
928
+ 13
929
+ I
930
+ 26
931
+ x
932
+ 59
933
+ /Users/bdurand/dev/projects/ref/test/soft_reference_test.rb
934
+ p
935
+ 1
936
+ x
937
+ 9
938
+ id_to_ref
939
+ x
940
+ 45
941
+ test_references_are_not_collected_immediately
942
+ M
943
+ 1
944
+ n
945
+ n
946
+ x
947
+ 45
948
+ test_references_are_not_collected_immediately
949
+ i
950
+ 96
951
+ 45
952
+ 0
953
+ 1
954
+ 43
955
+ 2
956
+ 13
957
+ 71
958
+ 3
959
+ 47
960
+ 9
961
+ 47
962
+ 47
963
+ 49
964
+ 4
965
+ 0
966
+ 13
967
+ 45
968
+ 5
969
+ 6
970
+ 13
971
+ 71
972
+ 3
973
+ 47
974
+ 9
975
+ 37
976
+ 47
977
+ 49
978
+ 4
979
+ 0
980
+ 13
981
+ 47
982
+ 49
983
+ 7
984
+ 0
985
+ 15
986
+ 8
987
+ 40
988
+ 49
989
+ 3
990
+ 0
991
+ 47
992
+ 49
993
+ 7
994
+ 1
995
+ 15
996
+ 8
997
+ 74
998
+ 45
999
+ 5
1000
+ 8
1001
+ 13
1002
+ 71
1003
+ 3
1004
+ 47
1005
+ 9
1006
+ 68
1007
+ 47
1008
+ 49
1009
+ 4
1010
+ 0
1011
+ 13
1012
+ 47
1013
+ 49
1014
+ 7
1015
+ 0
1016
+ 15
1017
+ 8
1018
+ 71
1019
+ 49
1020
+ 3
1021
+ 0
1022
+ 49
1023
+ 3
1024
+ 1
1025
+ 19
1026
+ 0
1027
+ 15
1028
+ 4
1029
+ 9
1030
+ 56
1031
+ 9
1032
+ 50
1033
+ 10
1034
+ 0
1035
+ 15
1036
+ 5
1037
+ 20
1038
+ 0
1039
+ 49
1040
+ 11
1041
+ 0
1042
+ 47
1043
+ 49
1044
+ 12
1045
+ 1
1046
+ 11
1047
+ I
1048
+ 5
1049
+ I
1050
+ 1
1051
+ I
1052
+ 0
1053
+ I
1054
+ 0
1055
+ n
1056
+ p
1057
+ 13
1058
+ x
1059
+ 3
1060
+ Ref
1061
+ n
1062
+ x
1063
+ 13
1064
+ SoftReference
1065
+ x
1066
+ 3
1067
+ new
1068
+ x
1069
+ 8
1070
+ allocate
1071
+ x
1072
+ 6
1073
+ Object
1074
+ n
1075
+ x
1076
+ 10
1077
+ initialize
1078
+ n
1079
+ M
1080
+ 1
1081
+ p
1082
+ 2
1083
+ x
1084
+ 9
1085
+ for_block
1086
+ t
1087
+ n
1088
+ x
1089
+ 45
1090
+ test_references_are_not_collected_immediately
1091
+ i
1092
+ 40
1093
+ 7
1094
+ 0
1095
+ 64
1096
+ 7
1097
+ 1
1098
+ 64
1099
+ 7
1100
+ 2
1101
+ 64
1102
+ 7
1103
+ 3
1104
+ 64
1105
+ 7
1106
+ 4
1107
+ 64
1108
+ 7
1109
+ 5
1110
+ 64
1111
+ 35
1112
+ 6
1113
+ 19
1114
+ 0
1115
+ 15
1116
+ 20
1117
+ 0
1118
+ 4
1119
+ 100
1120
+ 49
1121
+ 6
1122
+ 1
1123
+ 19
1124
+ 0
1125
+ 15
1126
+ 45
1127
+ 7
1128
+ 8
1129
+ 49
1130
+ 9
1131
+ 0
1132
+ 11
1133
+ I
1134
+ 8
1135
+ I
1136
+ 1
1137
+ I
1138
+ 0
1139
+ I
1140
+ 0
1141
+ I
1142
+ -2
1143
+ p
1144
+ 10
1145
+ s
1146
+ 8
1147
+ allocate
1148
+ s
1149
+ 4
1150
+ some
1151
+ s
1152
+ 6
1153
+ memory
1154
+ s
1155
+ 2
1156
+ on
1157
+ s
1158
+ 3
1159
+ the
1160
+ s
1161
+ 4
1162
+ heap
1163
+ x
1164
+ 1
1165
+ *
1166
+ x
1167
+ 2
1168
+ GC
1169
+ n
1170
+ x
1171
+ 5
1172
+ start
1173
+ p
1174
+ 3
1175
+ I
1176
+ 0
1177
+ I
1178
+ 27
1179
+ I
1180
+ 28
1181
+ x
1182
+ 59
1183
+ /Users/bdurand/dev/projects/ref/test/soft_reference_test.rb
1184
+ p
1185
+ 1
1186
+ x
1187
+ 3
1188
+ arr
1189
+ x
1190
+ 5
1191
+ times
1192
+ x
1193
+ 6
1194
+ object
1195
+ x
1196
+ 6
1197
+ assert
1198
+ p
1199
+ 9
1200
+ I
1201
+ -1
1202
+ I
1203
+ 25
1204
+ I
1205
+ 0
1206
+ I
1207
+ 26
1208
+ I
1209
+ 4d
1210
+ I
1211
+ 27
1212
+ I
1213
+ 55
1214
+ I
1215
+ 28
1216
+ I
1217
+ 60
1218
+ x
1219
+ 59
1220
+ /Users/bdurand/dev/projects/ref/test/soft_reference_test.rb
1221
+ p
1222
+ 1
1223
+ x
1224
+ 3
1225
+ ref
1226
+ x
1227
+ 12
1228
+ test_inspect
1229
+ M
1230
+ 1
1231
+ n
1232
+ n
1233
+ x
1234
+ 12
1235
+ test_inspect
1236
+ i
1237
+ 113
1238
+ 45
1239
+ 0
1240
+ 1
1241
+ 43
1242
+ 2
1243
+ 13
1244
+ 71
1245
+ 3
1246
+ 47
1247
+ 9
1248
+ 47
1249
+ 47
1250
+ 49
1251
+ 4
1252
+ 0
1253
+ 13
1254
+ 45
1255
+ 5
1256
+ 6
1257
+ 13
1258
+ 71
1259
+ 3
1260
+ 47
1261
+ 9
1262
+ 37
1263
+ 47
1264
+ 49
1265
+ 4
1266
+ 0
1267
+ 13
1268
+ 47
1269
+ 49
1270
+ 7
1271
+ 0
1272
+ 15
1273
+ 8
1274
+ 40
1275
+ 49
1276
+ 3
1277
+ 0
1278
+ 47
1279
+ 49
1280
+ 7
1281
+ 1
1282
+ 15
1283
+ 8
1284
+ 74
1285
+ 45
1286
+ 5
1287
+ 8
1288
+ 13
1289
+ 71
1290
+ 3
1291
+ 47
1292
+ 9
1293
+ 68
1294
+ 47
1295
+ 49
1296
+ 4
1297
+ 0
1298
+ 13
1299
+ 47
1300
+ 49
1301
+ 7
1302
+ 0
1303
+ 15
1304
+ 8
1305
+ 71
1306
+ 49
1307
+ 3
1308
+ 0
1309
+ 49
1310
+ 3
1311
+ 1
1312
+ 19
1313
+ 0
1314
+ 15
1315
+ 5
1316
+ 20
1317
+ 0
1318
+ 49
1319
+ 9
1320
+ 0
1321
+ 47
1322
+ 49
1323
+ 10
1324
+ 1
1325
+ 15
1326
+ 45
1327
+ 11
1328
+ 12
1329
+ 49
1330
+ 13
1331
+ 0
1332
+ 15
1333
+ 45
1334
+ 11
1335
+ 14
1336
+ 49
1337
+ 13
1338
+ 0
1339
+ 15
1340
+ 5
1341
+ 20
1342
+ 0
1343
+ 49
1344
+ 9
1345
+ 0
1346
+ 47
1347
+ 49
1348
+ 10
1349
+ 1
1350
+ 11
1351
+ I
1352
+ 5
1353
+ I
1354
+ 1
1355
+ I
1356
+ 0
1357
+ I
1358
+ 0
1359
+ n
1360
+ p
1361
+ 15
1362
+ x
1363
+ 3
1364
+ Ref
1365
+ n
1366
+ x
1367
+ 13
1368
+ SoftReference
1369
+ x
1370
+ 3
1371
+ new
1372
+ x
1373
+ 8
1374
+ allocate
1375
+ x
1376
+ 6
1377
+ Object
1378
+ n
1379
+ x
1380
+ 10
1381
+ initialize
1382
+ n
1383
+ x
1384
+ 7
1385
+ inspect
1386
+ x
1387
+ 6
1388
+ assert
1389
+ x
1390
+ 2
1391
+ GC
1392
+ n
1393
+ x
1394
+ 5
1395
+ start
1396
+ n
1397
+ p
1398
+ 13
1399
+ I
1400
+ -1
1401
+ I
1402
+ 2b
1403
+ I
1404
+ 0
1405
+ I
1406
+ 2c
1407
+ I
1408
+ 4d
1409
+ I
1410
+ 2d
1411
+ I
1412
+ 58
1413
+ I
1414
+ 2e
1415
+ I
1416
+ 5f
1417
+ I
1418
+ 2f
1419
+ I
1420
+ 66
1421
+ I
1422
+ 30
1423
+ I
1424
+ 71
1425
+ x
1426
+ 59
1427
+ /Users/bdurand/dev/projects/ref/test/soft_reference_test.rb
1428
+ p
1429
+ 1
1430
+ x
1431
+ 3
1432
+ ref
1433
+ p
1434
+ 9
1435
+ I
1436
+ 2
1437
+ I
1438
+ 5
1439
+ I
1440
+ 10
1441
+ I
1442
+ c
1443
+ I
1444
+ 1e
1445
+ I
1446
+ 25
1447
+ I
1448
+ 2c
1449
+ I
1450
+ 2b
1451
+ I
1452
+ 3a
1453
+ x
1454
+ 59
1455
+ /Users/bdurand/dev/projects/ref/test/soft_reference_test.rb
1456
+ p
1457
+ 0
1458
+ x
1459
+ 13
1460
+ attach_method
1461
+ p
1462
+ 7
1463
+ I
1464
+ 0
1465
+ I
1466
+ 1
1467
+ I
1468
+ 9
1469
+ I
1470
+ 2
1471
+ I
1472
+ 1c
1473
+ I
1474
+ 4
1475
+ I
1476
+ 3f
1477
+ x
1478
+ 59
1479
+ /Users/bdurand/dev/projects/ref/test/soft_reference_test.rb
1480
+ p
1481
+ 0