diff options
author | Kunshan Wang <wks1986@gmail.com> | 2023-07-21 02:17:38 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-20 14:17:38 -0400 |
commit | 639aa76e820480d707b90028972a52fd2a30957a (patch) | |
tree | 837d8ad1e422534b4ec8abc745811c54d942a4c8 /gc.c | |
parent | 460c27dc15b5efc46a74cb2a7809ca3fa6ce72a7 (diff) |
Embed struct rmatch into GC slot (#8097)
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -3509,8 +3509,8 @@ obj_free(rb_objspace_t *objspace, VALUE obj) if (!rb_data_free(objspace, obj)) return false; break; case T_MATCH: - if (RANY(obj)->as.match.rmatch) { - struct rmatch *rm = RANY(obj)->as.match.rmatch; + { + rb_matchext_t *rm = RMATCH_EXT(obj); #if USE_DEBUG_COUNTER if (rm->regs.num_regs >= 8) { RB_DEBUG_COUNTER_INC(obj_match_ge8); @@ -3525,7 +3525,6 @@ obj_free(rb_objspace_t *objspace, VALUE obj) onig_region_free(&rm->regs, 0); if (rm->char_offset) xfree(rm->char_offset); - xfree(rm); RB_DEBUG_COUNTER_INC(obj_match_ptr); } @@ -4841,11 +4840,10 @@ obj_memsize_of(VALUE obj, int use_all_types) if (use_all_types) size += rb_objspace_data_type_memsize(obj); break; case T_MATCH: - if (RMATCH(obj)->rmatch) { - struct rmatch *rm = RMATCH(obj)->rmatch; + { + rb_matchext_t *rm = RMATCH_EXT(obj); size += onig_region_memsize(&rm->regs); size += sizeof(struct rmatch_offset) * rm->char_offset_num_allocated; - size += sizeof(struct rmatch); } break; case T_FILE: |