e$B1sF#$G$9!#e(B
Class#dup e$B$,%a%b%j%j!<%/$9$k$h$&$G$9!#e(B
class C; end; loop { C.dup } e$B$G;HMQ%a%b%j$,=y!9$KA}$($F$-$^$9!#e(B
object.c e$B$Ne(B init_copy e$B$He(B class.c e$B$Ne(B rb_mod_init_copy
e$B$Ge(B RCLASS_IV_TBL e$B$re(B
e$BFs=E$K3NJ]$7$F$$$k$N$H!"8E$$e(B RCLASS_M_TBL
e$B$r2rJ|$7$F$$$J$$$3$H$,860x$Ne(B
e$B$h$&$G$9!#e(B
e$B0J2<$N%Q%C%A$GD>$j$^$9$,!“e(Binit_copy e$B$He(B rb_mod_init_copy
e$B$N;H$$J,$1$,NI$/e(B
e$BJ,$+$i$J$$$N$G!”@5$7$$$+J,$+$j$^$;$s!#e(B
e$BJQ$J$3$H$r$7$J$1$l$P$?$V$sIaDL$KF0$/$H;W$&$N$Ge(B (loop { C.dup }
e$B$bJQ$G$9e(B
e$B$,e(B) e$B!"0lC6%3%_%C%H$7$h$&$H;W$$$^$9!#e(B
diff --git a/class.c b/class.c
index a97494b…056e171 100644
— a/class.c
+++ b/class.c
@@ -151,6 +151,9 @@ rb_mod_init_copy(VALUE clone, VALUE orig)
if (RCLASS_IV_TBL(orig)) {
ID id;
- if (RCLASS_IV_TBL(clone)) {
-
st_free_table(RCLASS_IV_TBL(clone));
- }
RCLASS_IV_TBL(clone) = st_copy(RCLASS_IV_TBL(orig));
CONST_ID(id, “classpath”);
st_delete(RCLASS_IV_TBL(clone), (st_data_t*)&id, 0);
@@ -159,6 +162,11 @@ rb_mod_init_copy(VALUE clone, VALUE orig)
}
if (RCLASS_M_TBL(orig)) {
struct clone_method_data data; - if (RCLASS_M_TBL(clone)) {
-
extern void rb_free_m_table(st_table *tbl);
-
rb_free_m_table(RCLASS_M_TBL(clone));
- }
data.tbl = RCLASS_M_TBL(clone) = st_init_numtable();
data.klass = clone;
st_foreach(RCLASS_M_TBL(orig), clone_method,
diff --git a/gc.c b/gc.c
index f472bfc…9de079b 100644
— a/gc.c
+++ b/gc.c
@@ -1459,8 +1459,8 @@ free_method_entry_i(ID key, rb_method_entry_t
*me, st_data_t data)
return ST_CONTINUE;
}
-static void
-free_m_table(st_table *tbl)
+void
+rb_free_m_table(st_table *tbl)
{
st_foreach(tbl, free_method_entry_i, 0);
st_free_table(tbl);
@@ -1988,7 +1988,7 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
case T_MODULE:
case T_CLASS:
rb_clear_cache_by_class((VALUE)obj);
- free_m_table(RCLASS_M_TBL(obj));
- rb_free_m_table(RCLASS_M_TBL(obj));
if (RCLASS_IV_TBL(obj)) {
st_free_table(RCLASS_IV_TBL(obj));
}