summaryrefslogtreecommitdiff
path: root/method.h
diff options
context:
space:
mode:
authorAdam Hess <[email protected]>2023-09-20 09:26:31 -0700
committerPeter Zhu <[email protected]>2023-09-22 09:44:58 -0400
commit8b236e0c66da8f92e9fc33de66cfbc8e4b0c0763 (patch)
tree8154d0859136c1a4e5fa51a4267f448f3c1fab32 /method.h
parentf59b488b5a7f6e46e3e6d80d2b0a269e7d937a30 (diff)
[Bug #19896]
fix memory leak in vm_method This introduces a unified reference_count to clarify who is referencing a method. This also allows us to treat the refinement method as the def owner since it counts itself as a reference Co-authored-by: Peter Zhu <[email protected]>
Diffstat (limited to 'method.h')
-rw-r--r--method.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/method.h b/method.h
index fbbcad075f..ef096e543b 100644
--- a/method.h
+++ b/method.h
@@ -179,9 +179,9 @@ typedef struct rb_method_optimized {
struct rb_method_definition_struct {
BITFIELD(rb_method_type_t, type, VM_METHOD_TYPE_MINIMUM_BITS);
unsigned int iseq_overload: 1;
- int alias_count : 27;
- int complemented_count : 28;
unsigned int no_redef_warning: 1;
+ unsigned int aliased : 1;
+ int reference_count : 28;
union {
rb_method_iseq_t iseq;
@@ -214,7 +214,7 @@ void rb_add_method_optimized(VALUE klass, ID mid, enum method_optimized_type, un
void rb_add_refined_method_entry(VALUE refined_class, ID mid);
rb_method_entry_t *rb_method_entry_set(VALUE klass, ID mid, const rb_method_entry_t *, rb_method_visibility_t noex);
-rb_method_entry_t *rb_method_entry_create(ID called_id, VALUE klass, rb_method_visibility_t visi, const rb_method_definition_t *def);
+rb_method_entry_t *rb_method_entry_create(ID called_id, VALUE klass, rb_method_visibility_t visi, rb_method_definition_t *def);
const rb_method_entry_t *rb_method_entry_at(VALUE obj, ID id);