diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c index 337dcb87e2..f78b43855c 100644 --- a/ext/objspace/objspace.c +++ b/ext/objspace/objspace.c @@ -60,7 +60,9 @@ memsize_of(VALUE obj) break; case T_MODULE: case T_CLASS: - size += st_memsize(RCLASS_M_TBL(obj)); + if (RCLASS_M_TBL(obj)) { + size += st_memsize(RCLASS_M_TBL(obj)); + } if (RCLASS_IV_TBL(obj)) { size += st_memsize(RCLASS_IV_TBL(obj)); }