cvsuser 03/09/23 02:35:35
Modified: classes pmc2c.pl
. interpreter.c
Log:
remove vtable memory leaks
Revision Changes Path
1.42 +9 -4 parrot/classes/pmc2c.pl
Index: pmc2c.pl
===================================================================
RCS file: /cvs/public/parrot/classes/pmc2c.pl,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -w -r1.41 -r1.42
--- pmc2c.pl 22 Sep 2003 19:27:38 -0000 1.41
+++ pmc2c.pl 23 Sep 2003 09:35:33 -0000 1.42
@@ -760,11 +760,16 @@
$methodlist
};
- if (!temp_base_vtable.whoami)
+ /* parrotio calls some class_init functions during its class_init
+ * code, so some of the slots might already be allocated
+ */
+ if (Parrot_base_vtables[entry])
+ return;
temp_base_vtable.whoami = string_make(interp,
"$classname", @{[length($classname)]}, 0, PObj_constant_FLAG, 0);
- Parrot_base_vtables[entry] = Parrot_clone_vtable(interp, &temp_base_vtable);
+ Parrot_base_vtables[entry] =
+ Parrot_clone_vtable(interp, &temp_base_vtable);
$class_init_code
}
EOC
1.200 +4 -1 parrot/interpreter.c
Index: interpreter.c
===================================================================
RCS file: /cvs/public/parrot/interpreter.c,v
retrieving revision 1.199
retrieving revision 1.200
diff -u -w -r1.199 -r1.200
--- interpreter.c 28 Aug 2003 15:26:21 -0000 1.199
+++ interpreter.c 23 Sep 2003 09:35:34 -0000 1.200
@@ -1,7 +1,7 @@
/* interpreter.c
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: interpreter.c,v 1.199 2003/08/28 15:26:21 leo Exp $
+ * $Id: interpreter.c,v 1.200 2003/09/23 09:35:34 leo Exp $
* Overview:
* The interpreter api handles running the operations
* Data Structure and Algorithms:
@@ -900,6 +900,9 @@
mem_sys_free(stash);
stash = next_stash;
}
+ /* free vtables */
+ for (i = 1; i < (int)enum_class_max; i++)
+ Parrot_destroy_vtable(interpreter, Parrot_base_vtables[i]);
if (interpreter->profile)
mem_sys_free(interpreter->profile);