Project

General

Profile

« Previous | Next » 

Revision 39725a4d

Added by shyouhei (Shyouhei Urabe) over 5 years ago

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 minirubyfinalize_list(objspace=0x0000000101c09240, zombie=4329149840) + 999 at gc.c:2946 frame #1: 0x000000010026a69e minirubyrb_objspace_call_finalizer(objspace=0x0000000101c09240) + 7118 at gc.c:3092
      frame #2: 0x0000000100268ac5 minirubyrb_gc_call_finalizer_at_exit + 149 at gc.c:3015 frame #3: 0x00000001002272bc minirubyruby_finalize_1 + 156 at eval.c:146
      frame #4: 0x00000001002282b6 minirubyruby_cleanup(ex=0) + 4070 at eval.c:238 frame #5: 0x0000000100228785 minirubyruby_run_node(n=0x0000000102060ad8) + 85 at eval.c:317
      frame #6: 0x0000000100000b9c minirubymain(argc=2, argv=0x00007fff5fbfdc38) + 124 at main.c:42 frame #7: 0x00007fff9966a5ad libdyld.dylibstart + 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-823fe69b080e