Show whether object is garbage in rb_raw_obj_info()
When using `rp(obj)` for debugging during development, it may be useful to know that an object is soon to be swept. Add a new letter to the object dump for whether the object is garbage. It's easy to forget about lazy sweep.
This commit is contained in:
parent
8b1b4e384f
commit
39cf0b5314
Notes:
git
2021-12-21 06:14:11 +09:00
Merged: https://github.com/ruby/ruby/pull/5310 Merged-By: XrXr
3
gc.c
3
gc.c
@ -13093,13 +13093,14 @@ rb_raw_obj_info(char *buff, const int buff_size, VALUE obj)
|
|||||||
const int age = RVALUE_FLAGS_AGE(RBASIC(obj)->flags);
|
const int age = RVALUE_FLAGS_AGE(RBASIC(obj)->flags);
|
||||||
|
|
||||||
if (is_pointer_to_heap(&rb_objspace, (void *)obj)) {
|
if (is_pointer_to_heap(&rb_objspace, (void *)obj)) {
|
||||||
APPENDF((BUFF_ARGS, "%p [%d%s%s%s%s%s] %s ",
|
APPENDF((BUFF_ARGS, "%p [%d%s%s%s%s%s%s] %s ",
|
||||||
(void *)obj, age,
|
(void *)obj, age,
|
||||||
C(RVALUE_UNCOLLECTIBLE_BITMAP(obj), "L"),
|
C(RVALUE_UNCOLLECTIBLE_BITMAP(obj), "L"),
|
||||||
C(RVALUE_MARK_BITMAP(obj), "M"),
|
C(RVALUE_MARK_BITMAP(obj), "M"),
|
||||||
C(RVALUE_PIN_BITMAP(obj), "P"),
|
C(RVALUE_PIN_BITMAP(obj), "P"),
|
||||||
C(RVALUE_MARKING_BITMAP(obj), "R"),
|
C(RVALUE_MARKING_BITMAP(obj), "R"),
|
||||||
C(RVALUE_WB_UNPROTECTED_BITMAP(obj), "U"),
|
C(RVALUE_WB_UNPROTECTED_BITMAP(obj), "U"),
|
||||||
|
C(rb_objspace_garbage_object_p(obj), "G"),
|
||||||
obj_type_name(obj)));
|
obj_type_name(obj)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user