2 # Copyright (C) 2010, Parrot Foundation.
7 t/op/gc-leaky-box.t - test for memory leaks in the Garbage Collector
11 % prove t/op/gc-leaky-box.t
15 Tests that we actually do a GC mark and sweep after a large number of PMC's have
16 been created. Test suggested by chromatic++ . Also includes tests for
17 TT1465 - http://trac.parrot.org/parrot/ticket/1465 .
21 # 20:57 <chromatic> For every million PMCs allocated, see that the GC has performed a mark/sweep.
23 .include 'interpinfo.pasm'
26 .include 'test_more.pir'
30 $S0 = interpinfo .INTERPINFO_GC_SYS_NAME
31 if $S0 == "inf" goto dont_run_hanging_tests
36 dont_run_hanging_tests:
37 ok(1, "#TODO - Test disabled on gc_inf")
38 ok(1, "#TODO - Test disabled on gc_inf")
39 ok(1, "#TODO - Test disabled on gc_inf")
43 .sub test_gc_mark_sweep
50 if counter < 2e6 goto loop
52 $I1 = interpinfo.INTERPINFO_GC_COLLECT_RUNS
53 $I2 = interpinfo.INTERPINFO_GC_MARK_RUNS
54 $I3 = interpinfo.INTERPINFO_TOTAL_MEM_ALLOC
57 $S0 = "performed " . $S1
58 $S0 .= " (which should be >=1) GC collect runs"
62 $S0 = "performed " . $S1
63 $S0 .= " (which should be >=1) GC mark runs"
67 $S0 = "allocated " . $S1
68 $S0 .= " (which should be <= 2_000_000) bytes of memory"
69 $I4 = isle $I3, 2000000
77 # vim: expandtab shiftwidth=4 ft=pir: