cvsuser 03/06/30 03:20:07
Modified: . interpreter.c
t/pmc io.t
Log:
destroy PMCs at interpreter end if needed; fdopen test
Revision Changes Path
1.164 +10 -1 parrot/interpreter.c
Index: interpreter.c
===================================================================
RCS file: /cvs/public/parrot/interpreter.c,v
retrieving revision 1.163
retrieving revision 1.164
diff -u -w -r1.163 -r1.164
--- interpreter.c 28 Jun 2003 11:25:08 -0000 1.163
+++ interpreter.c 30 Jun 2003 10:20:04 -0000 1.164
@@ -1,7 +1,7 @@
/* interpreter.c
* Copyright: (When this is determined...it will go here)
* CVS Info
- * $Id: interpreter.c,v 1.163 2003/06/28 11:25:08 leo Exp $
+ * $Id: interpreter.c,v 1.164 2003/06/30 10:20:04 leo Exp $
* Overview:
* The interpreter api handles running the operations
* Data Structure and Algorithms:
@@ -614,9 +614,18 @@
struct Stash *stash, *next_stash;
UNUSED(exit_code);
+ /* if something needs timely destruction (e.g. closing PIOs)
+ * we must destroy it now:
+ * no DOD run, so everything is considered dead
+ */
+
+ if (interpreter->has_early_DOD_PMCs)
+ free_unused_pobjects(interpreter, interpreter->arena_base->pmc_pool);
+
/* we destroy all child interpreters and the last one too,
* if the --leak-test commandline was given
*/
+
if (! (interpreter->parent_interpreter ||
Interp_flags_TEST(interpreter, PARROT_DESTROY_FLAG)))
return;
1.3 +28 -1 parrot/t/pmc/io.t
Index: io.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/io.t,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -r1.2 -r1.3
--- io.t 26 Jun 2003 08:01:34 -0000 1.2
+++ io.t 30 Jun 2003 10:20:07 -0000 1.3
@@ -1,6 +1,6 @@
#! perl -w
-use Parrot::Test tests => 2;
+use Parrot::Test tests => 4;
use Test::More;
output_is(<<'CODE', <<'OUTPUT', "open/close");
@@ -32,6 +32,33 @@
CODE
a line
1
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "fdopen");
+ fdopen P0, 1, ">"
+ defined I0, P0
+ unless I0, nok
+ print P0, "ok\n"
+ close P0
+ end
+nok:
+ print "fdopen failed\n"
+ end
+CODE
+ok
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "fdopen - no close");
+ fdopen P0, 1, ">"
+ defined I0, P0
+ unless I0, nok
+ print P0, "ok\n"
+ end
+nok:
+ print "fdopen failed\n"
+ end
+CODE
+ok
OUTPUT
unlink("temp.file");