[svn:parrot] r48579 - in trunk: . src/gc t/op
nwellnhof at svn.parrot.org
nwellnhof at svn.parrot.org
Fri Aug 20 11:54:54 UTC 2010
Author: nwellnhof
Date: Fri Aug 20 11:54:52 2010
New Revision: 48579
URL: https://trac.parrot.org/parrot/changeset/48579
Log:
Account for fixed size pools in memory_allocated
Also add tests for TT#945 and TT#1465. Both are still TODO but I
have a fix in TT#1737.
Added:
trunk/t/op/gc-leaky-box.t
- copied, changed from r48577, trunk/t/op/gc-leaky.t
trunk/t/op/gc-leaky-call.t
Deleted:
trunk/t/op/gc-leaky.t
Modified:
trunk/MANIFEST
trunk/src/gc/gc_private.h
trunk/src/gc/mark_sweep.c
Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST Fri Aug 20 11:26:52 2010 (r48578)
+++ trunk/MANIFEST Fri Aug 20 11:54:52 2010 (r48579)
@@ -1,8 +1,6 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Thu Aug 19 06:48:17 2010 UT
-#
# See below for documentation on the format of this file.
#
# See docs/submissions.pod and the documentation in
@@ -1801,7 +1799,8 @@
t/op/exceptions.t [test]
t/op/exit.t [test]
t/op/fetch.t [test]
-t/op/gc-leaky.t [test]
+t/op/gc-leaky-box.t [test]
+t/op/gc-leaky-call.t [test]
t/op/gc.t [test]
t/op/globals.t [test]
t/op/ifunless.t [test]
Modified: trunk/src/gc/gc_private.h
==============================================================================
--- trunk/src/gc/gc_private.h Fri Aug 20 11:26:52 2010 (r48578)
+++ trunk/src/gc/gc_private.h Fri Aug 20 11:54:52 2010 (r48579)
@@ -320,13 +320,13 @@
* blocks allocated from
* the system since the last
* GC run */
- size_t memory_allocated; /* The total amount of allocatable memory
- * allocated. Doesn't count memory for
- * headers or internal structures or
- * anything */
- size_t memory_used; /* The total amount of
- * memory used for
- * buffers and headers */
+ size_t memory_allocated; /* The total amount of memory allocated
+ * in fixed and variable size pools.
+ * Doesn't count memory for internal
+ * structures */
+ size_t memory_used; /* The total amount of memory used
+ * in fixed and variable size
+ * pools. */
size_t mem_used_last_collect; /* The total amount of
* memory used after
* the last GC run */
Modified: trunk/src/gc/mark_sweep.c
==============================================================================
--- trunk/src/gc/mark_sweep.c Fri Aug 20 11:26:52 2010 (r48578)
+++ trunk/src/gc/mark_sweep.c Fri Aug 20 11:54:52 2010 (r48579)
@@ -481,6 +481,7 @@
pool->last_Arena = new_arena;
mem_pools->header_allocs_since_last_collect += size;
+ mem_pools->memory_allocated += size;
}
/*
Copied and modified: trunk/t/op/gc-leaky-box.t (from r48577, trunk/t/op/gc-leaky.t)
==============================================================================
--- trunk/t/op/gc-leaky.t Fri Aug 20 08:32:39 2010 (r48577, copy source)
+++ trunk/t/op/gc-leaky-box.t Fri Aug 20 11:54:52 2010 (r48579)
@@ -4,16 +4,16 @@
=head1 NAME
-t/op/gc-leaky.t - test for memory leaks in the Garbage Collector
+t/op/gc-leaky-box.t - test for memory leaks in the Garbage Collector
=head1 SYNOPSIS
- % prove t/op/gc-leaky.t
+ % prove t/op/gc-leaky-box.t
=head1 DESCRIPTION
Tests that we actually do a GC mark and sweep after a large number of PMC's have
-been created. Test suggested by chromatic++ . More tests are needed to close
+been created. Test suggested by chromatic++ . Also includes tests for
TT1465 - http://trac.parrot.org/parrot/ticket/1465 .
=cut
@@ -25,7 +25,7 @@
.sub _main :main
.include 'test_more.pir'
- plan(2)
+ plan(3)
$S0 = interpinfo .INTERPINFO_GC_SYS_NAME
if $S0 == "inf" goto dont_run_hanging_tests
@@ -36,34 +36,38 @@
dont_run_hanging_tests:
ok(1, "#TODO - Test disabled on gc_inf")
ok(1, "#TODO - Test disabled on gc_inf")
+ ok(1, "#TODO - Test disabled on gc_inf")
test_end:
.end
.sub test_gc_mark_sweep
.local int counter
+
counter = 0
- loop:
- $P0 = box 0
- inc counter
- if counter > 1e6 goto done
- goto loop
- done:
- diag("")
- $I1 = interpinfo.INTERPINFO_GC_COLLECT_RUNS
- $I2 = interpinfo.INTERPINFO_GC_MARK_RUNS
-
- $I3 = isge $I1, 1
- $I4 = isge $I2, 1
-
- $S1 = $I1
- $S0 = "performed " . $S1
- $S0 .= " (which should be >=1) GC collect runs"
- ok($I2,$S0)
-
- $S1 = $I2
- $S0 = "performed " . $S1
- $S0 .= " (which should be >=1) GC mark runs"
- ok($I2,$S0)
+ loop:
+ $P0 = box 0
+ inc counter
+ if counter < 10e6 goto loop
+
+ diag("")
+ $I1 = interpinfo.INTERPINFO_GC_COLLECT_RUNS
+ $S1 = $I1
+ $S0 = "performed " . $S1
+ $S0 .= " (which should be >=1) GC collect runs"
+ ok($I1,$S0)
+
+ $I1 = interpinfo.INTERPINFO_GC_MARK_RUNS
+ $S1 = $I1
+ $S0 = "performed " . $S1
+ $S0 .= " (which should be >=1) GC mark runs"
+ ok($I1,$S0)
+
+ $I1 = interpinfo.INTERPINFO_TOTAL_MEM_ALLOC
+ $S1 = $I1
+ $S0 = "allocated " . $S1
+ $S0 .= " (which should be <= 2_000_000) bytes of memory, TODO: TT#1465"
+ $I2 = isle $I1, 2000000
+ todo($I2,$S0)
.end
# Local Variables:
Added: trunk/t/op/gc-leaky-call.t
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/t/op/gc-leaky-call.t Fri Aug 20 11:54:52 2010 (r48579)
@@ -0,0 +1,77 @@
+#!./parrot
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+t/op/gc-leaky-call.t - test for memory leaks in the Garbage Collector
+
+=head1 SYNOPSIS
+
+ % prove t/op/gc-leaky-call.t
+
+=head1 DESCRIPTION
+
+Tests that we actually do a GC mark and sweep after a large number of
+function calls.
+
+=cut
+
+.include 'interpinfo.pasm'
+
+.sub _main :main
+ .include 'test_more.pir'
+
+ plan(3)
+
+ $S0 = interpinfo .INTERPINFO_GC_SYS_NAME
+ if $S0 == "inf" goto dont_run_hanging_tests
+
+ test_gc_mark_sweep()
+
+ goto test_end
+ dont_run_hanging_tests:
+ ok(1, "#TODO - Test disabled on gc_inf")
+ ok(1, "#TODO - Test disabled on gc_inf")
+ ok(1, "#TODO - Test disabled on gc_inf")
+ test_end:
+.end
+
+.sub test_gc_mark_sweep
+ .local int counter
+
+ counter = 0
+ loop:
+ consume()
+ inc counter
+ if counter < 10e6 goto loop
+
+ diag("")
+ $I1 = interpinfo.INTERPINFO_GC_COLLECT_RUNS
+ $S1 = $I1
+ $S0 = "performed " . $S1
+ $S0 .= " (which should be >=1) GC collect runs"
+ ok($I1,$S0)
+
+ $I1 = interpinfo.INTERPINFO_GC_MARK_RUNS
+ $S1 = $I1
+ $S0 = "performed " . $S1
+ $S0 .= " (which should be >=1) GC mark runs"
+ ok($I1,$S0)
+
+ $I1 = interpinfo.INTERPINFO_TOTAL_MEM_ALLOC
+ $S1 = $I1
+ $S0 = "allocated " . $S1
+ $S0 .= " (which should be <= 2_000_000) bytes of memory, TODO: TT#945"
+ $I2 = isle $I1, 2000000
+ todo($I2,$S0)
+.end
+
+.sub consume
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
Deleted: trunk/t/op/gc-leaky.t
==============================================================================
--- trunk/t/op/gc-leaky.t Fri Aug 20 11:54:52 2010 (r48578)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,73 +0,0 @@
-#!./parrot
-# Copyright (C) 2010, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-t/op/gc-leaky.t - test for memory leaks in the Garbage Collector
-
-=head1 SYNOPSIS
-
- % prove t/op/gc-leaky.t
-
-=head1 DESCRIPTION
-
-Tests that we actually do a GC mark and sweep after a large number of PMC's have
-been created. Test suggested by chromatic++ . More tests are needed to close
-TT1465 - http://trac.parrot.org/parrot/ticket/1465 .
-
-=cut
-
-# 20:57 <chromatic> For every million PMCs allocated, see that the GC has performed a mark/sweep.
-
-.include 'interpinfo.pasm'
-
-.sub _main :main
- .include 'test_more.pir'
-
- plan(2)
-
- $S0 = interpinfo .INTERPINFO_GC_SYS_NAME
- if $S0 == "inf" goto dont_run_hanging_tests
-
- test_gc_mark_sweep()
-
- goto test_end
- dont_run_hanging_tests:
- ok(1, "#TODO - Test disabled on gc_inf")
- ok(1, "#TODO - Test disabled on gc_inf")
- test_end:
-.end
-
-.sub test_gc_mark_sweep
- .local int counter
- counter = 0
- loop:
- $P0 = box 0
- inc counter
- if counter > 1e6 goto done
- goto loop
- done:
- diag("")
- $I1 = interpinfo.INTERPINFO_GC_COLLECT_RUNS
- $I2 = interpinfo.INTERPINFO_GC_MARK_RUNS
-
- $I3 = isge $I1, 1
- $I4 = isge $I2, 1
-
- $S1 = $I1
- $S0 = "performed " . $S1
- $S0 .= " (which should be >=1) GC collect runs"
- ok($I2,$S0)
-
- $S1 = $I2
- $S0 = "performed " . $S1
- $S0 .= " (which should be >=1) GC mark runs"
- ok($I2,$S0)
-.end
-
-# Local Variables:
-# mode: pir
-# fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:
More information about the parrot-commits
mailing list