Commit 39725a4
committed
gc.c: avoid integer overflow at process exit
This is rather nitpicking but at the moment the process terminates,
heap_pages_final_slots overflows.
(lldb) bt
* thread #1: tid = 0xc0903, 0x00000001002b3bf7 miniruby`finalize_list(objspace=0x0000000101c09240, zombie=4329149840) + 999 at gc.c:2946, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
* frame #0: 0x00000001002b3bf7 miniruby`finalize_list(objspace=0x0000000101c09240, zombie=4329149840) + 999 at gc.c:2946
frame #1: 0x000000010026a69e miniruby`rb_objspace_call_finalizer(objspace=0x0000000101c09240) + 7118 at gc.c:3092
frame #2: 0x0000000100268ac5 miniruby`rb_gc_call_finalizer_at_exit + 149 at gc.c:3015
frame #3: 0x00000001002272bc miniruby`ruby_finalize_1 + 156 at eval.c:146
frame #4: 0x00000001002282b6 miniruby`ruby_cleanup(ex=0) + 4070 at eval.c:238
frame #5: 0x0000000100228785 miniruby`ruby_run_node(n=0x0000000102060ad8) + 85 at eval.c:317
frame #6: 0x0000000100000b9c miniruby`main(argc=2, argv=0x00007fff5fbfdc38) + 124 at main.c:42
frame #7: 0x00007fff9966a5ad libdyld.dylib`start + 1
frame #8: 0x00007fff9966a5ad libdyld.dylib`start + 1
(lldb) p objspace->heap_pages
(rb_objspace::(anonymous struct)) $0 = {
sorted = 0x0000000101c070b0
allocated_pages = 24
allocatable_pages = 0
sorted_length = 24
range = {
[0] = 0x0000000102020028
[1] = 0x00000001020dbfd0
}
freeable_pages = 0
final_slots = 0
deferred_final = 4329149840
}
(lldb)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e1 parent 3483e6d commit 39725a4
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2943 | 2943 | | |
2944 | 2944 | | |
2945 | 2945 | | |
2946 | | - | |
| 2946 | + | |
2947 | 2947 | | |
2948 | 2948 | | |
2949 | 2949 | | |
| |||
0 commit comments