Fix SEGV caused by GC::Profiler.raw_data
(#9122)
This commit is contained in:
parent
5078aa825c
commit
4f213ea1ba
2
gc.c
2
gc.c
@ -13258,7 +13258,7 @@ gc_profile_record_get(VALUE _)
|
|||||||
gc_profile_record *record = &objspace->profile.records[i];
|
gc_profile_record *record = &objspace->profile.records[i];
|
||||||
|
|
||||||
prof = rb_hash_new();
|
prof = rb_hash_new();
|
||||||
rb_hash_aset(prof, ID2SYM(rb_intern("GC_FLAGS")), gc_info_decode(0, rb_hash_new(), record->flags));
|
rb_hash_aset(prof, ID2SYM(rb_intern("GC_FLAGS")), gc_info_decode(objspace, rb_hash_new(), record->flags));
|
||||||
rb_hash_aset(prof, ID2SYM(rb_intern("GC_TIME")), DBL2NUM(record->gc_time));
|
rb_hash_aset(prof, ID2SYM(rb_intern("GC_TIME")), DBL2NUM(record->gc_time));
|
||||||
rb_hash_aset(prof, ID2SYM(rb_intern("GC_INVOKE_TIME")), DBL2NUM(record->gc_invoke_time));
|
rb_hash_aset(prof, ID2SYM(rb_intern("GC_INVOKE_TIME")), DBL2NUM(record->gc_invoke_time));
|
||||||
rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_USE_SIZE")), SIZET2NUM(record->heap_use_size));
|
rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_USE_SIZE")), SIZET2NUM(record->heap_use_size));
|
||||||
|
@ -579,6 +579,14 @@ class TestGc < Test::Unit::TestCase
|
|||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_profiler_raw_data
|
||||||
|
GC::Profiler.enable
|
||||||
|
GC.start
|
||||||
|
assert GC::Profiler.raw_data
|
||||||
|
ensure
|
||||||
|
GC::Profiler.disable
|
||||||
|
end
|
||||||
|
|
||||||
def test_profiler_total_time
|
def test_profiler_total_time
|
||||||
GC::Profiler.enable
|
GC::Profiler.enable
|
||||||
GC::Profiler.clear
|
GC::Profiler.clear
|
||||||
|
Loading…
x
Reference in New Issue
Block a user