summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2026-05-02 06:55:30 +0200
committerJean Boussier <jean.boussier@gmail.com>2026-05-02 08:46:36 +0200
commit45d586ad60ba807dbb8c5f17b0ac156095eb4fbf (patch)
treeda3403fc52f4e4d4ded5b57a6231c84d54c1941b /object.c
parentf2845eab29cf4e52af447a4041b5888c0e582882 (diff)
Never increment `max_iv_count` on Object / BasicObject.
Otherwise some code defining ivars on a naked object early during program boot can cause all objects to be larger than needed. This seem like it was always the intention, but wasn't quite properly prevented. Also stop updating `max_iv_count` during GC marking as it is redundant.
Diffstat (limited to 'object.c')
-rw-r--r--object.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/object.c b/object.c
index eaec5e89d2..23a83c572e 100644
--- a/object.c
+++ b/object.c
@@ -2224,6 +2224,7 @@ rb_class_initialize(int argc, VALUE *argv, VALUE klass)
}
}
rb_class_set_super(klass, super);
+ RCLASS_SET_MAX_IV_COUNT(klass, RCLASS_MAX_IV_COUNT(super));
RCLASS_SET_ALLOCATOR(klass, RCLASS_ALLOCATOR(super));
rb_make_metaclass(klass, RBASIC(super)->klass);
rb_class_inherited(super, klass);