[svn:parrot] r48623 - in trunk: . t/op

nwellnhof at svn.parrot.org nwellnhof at svn.parrot.org
Tue Aug 24 13:39:59 UTC 2010


Author: nwellnhof
Date: Tue Aug 24 13:39:59 2010
New Revision: 48623
URL: https://trac.parrot.org/parrot/changeset/48623

Log:
Add test case for TT#1603

Added:
   trunk/t/op/gc-active-buffers.t
Modified:
   trunk/MANIFEST

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	Tue Aug 24 13:32:23 2010	(r48622)
+++ trunk/MANIFEST	Tue Aug 24 13:39:59 2010	(r48623)
@@ -1,8 +1,6 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Fri Aug 20 12:55:40 2010 UT
-#
 # See below for documentation on the format of this file.
 #
 # See docs/submissions.pod and the documentation in
@@ -1804,6 +1802,7 @@
 t/op/exceptions.t                                           [test]
 t/op/exit.t                                                 [test]
 t/op/fetch.t                                                [test]
+t/op/gc-active-buffers.t                                    [test]
 t/op/gc-leaky-box.t                                         [test]
 t/op/gc-leaky-call.t                                        [test]
 t/op/gc.t                                                   [test]

Added: trunk/t/op/gc-active-buffers.t
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/t/op/gc-active-buffers.t	Tue Aug 24 13:39:59 2010	(r48623)
@@ -0,0 +1,62 @@
+#!./parrot
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+t/op/gc-active-buffers.t - Test that buffers are freed as soon as possible
+
+=head1 SYNOPSIS
+
+    % prove t/op/gc-active-buffers.t
+
+=head1 DESCRIPTION
+
+Tests that unused buffers (strings) are freed in the first GC run. See
+TT1603 - http://trac.parrot.org/parrot/ticket/1603
+
+=cut
+
+.include 'interpinfo.pasm'
+
+.sub _main :main
+    .include 'test_more.pir'
+
+    plan(1)
+
+    sweep 1
+    $I0 = interpinfo .INTERPINFO_ACTIVE_BUFFERS
+
+    .local int count
+    count= 1000
+  loop:
+        unless count goto done
+
+        # original test form TT1603
+        $P0 = new 'CodeString'
+        $P0.'emit'("a")
+        $S0 = $P0
+
+        # another way to trigger the problem
+        $S1 = "abc"
+        $S2 = substr $S1, 0, 1
+
+        dec count
+    goto loop
+  done:
+
+    sweep 1
+    $I1 = interpinfo .INTERPINFO_ACTIVE_BUFFERS
+
+    $I2 = $I1 - $I0
+    $S0 = $I2
+    $S0 .= " additional active buffers (which should be <= 100)"
+    $I3 = isle $I2, 100
+    ok($I3, $S0)
+ .end
+
+# Local Variables:
+#   mode: pir
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:


More information about the parrot-commits mailing list