-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Deprecate rb_gc_force_recycle
#4363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate rb_gc_force_recycle
#4363
Conversation
a2ee0c4 to
ebc2cc6
Compare
include/ruby/internal/intern/gc.h
Outdated
| * @deprecated This is now a no-op function, use RB_GC_GUARD instead. | ||
| */ | ||
| RBIMPL_ATTR_DEPRECATED(("this is now a no-op function, use RB_GC_GUARD instead")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "use RB_GC_GUARD instead" advice can be unsought. People might not understand why they should use RB_GC_GUARD instead of it. In fact they don't have to, unless they are Eric Wong. It seems nobody except Eric could be creative enough to abuse this function as a GC guard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. I've updated the message to not include that suggestion.
This commit removes usages of rb_gc_force_recycle since it is a burden to maintain and makes changes to the GC difficult.
ebc2cc6 to
49dbf0a
Compare
gc.c
Outdated
| */ | ||
| } | ||
| RB_VM_LOCK_LEAVE(); | ||
| RB_GC_GUARD(obj); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is it needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I don't think it's needed.
…mark_stack_chunk This commit deprecates rb_gc_force_recycle and coverts it to a no-op function. Also removes invalidate_mark_stack_chunk since only rb_gc_force_recycle uses it.
49dbf0a to
ba92b0d
Compare
|
Could you add about this change on NEWS? (sorry I missed it before merging) |
I'm proposing to deprecate
rb_gc_force_recycleand make it a no-op function because it is a burden to maintain and makes changes to the GC difficult. It is also easy to incorrectly use this function and cause memory leaks such as #18065.