From: Tanaka Akira Date: 2007-07-08T09:43:32+09:00 Subject: [ruby-dev:31163] Invalid read of size 4: valgrind ./ruby -ve 'print "a"' 以下のようにすると、rb_thread_alone で Invalid read of size 4 になるようです。 % valgrind ./ruby -ve 'print "a"' ==25885== Memcheck, a memory error detector. ==25885== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et al. ==25885== Using LibVEX rev 1658, a library for dynamic binary translation. ==25885== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP. ==25885== Using valgrind-3.2.1-Debian, a dynamic binary instrumentation framework. ==25885== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al. ==25885== For more details, rerun with: -v ==25885== --25885-- DWARF2 CFI reader: unhandled CFI instruction 0:50 --25885-- DWARF2 CFI reader: unhandled CFI instruction 0:50 --25885-- DWARF2 CFI reader: unhandled CFI instruction 0:50 --25885-- DWARF2 CFI reader: unhandled CFI instruction 0:50 ruby 1.9.0 (2007-07-07 patchlevel 0) [i686-linux] ==25885== Invalid read of size 4 ==25885== at 0x80F46FF: rb_thread_alone (thread.c:1464) ==25885== by 0x80F3A84: rb_thread_schedule (thread.c:601) ==25885== by 0x80F3CF6: rb_thread_execute_interrupts (thread.c:710) ==25885== by 0x80F313C: set_unblock_function (thread.c:194) ==25885== by 0x80F4B94: do_select (thread.c:1716) ==25885== by 0x80F4D02: rb_thread_wait_fd_rw (thread.c:1764) ==25885== by 0x80F4D6E: rb_thread_fd_writable (thread.c:1786) ==25885== by 0x806398C: io_fflush (io.c:421) ==25885== by 0x80667A6: fptr_finalize (io.c:2212) ==25885== by 0x8066898: rb_io_fptr_cleanup (io.c:2244) ==25885== by 0x806691F: rb_io_fptr_finalize (io.c:2258) ==25885== by 0x8062D96: rb_gc_call_finalizer_at_exit (gc.c:1987) ==25885== Address 0x42EF8A0 is 8 bytes inside a block of size 16 free'd ==25885== at 0x401CFA5: free (vg_replace_malloc.c:233) ==25885== by 0x80C4BDE: st_free_table (st.c:215) ==25885== by 0x80F1BF1: vm_free (yarvcore.c:153) ==25885== by 0x8062D79: rb_gc_call_finalizer_at_exit (gc.c:1983) ==25885== by 0x80599D3: ruby_finalize_1 (eval.c:146) ==25885== by 0x8059ABA: ruby_cleanup (eval.c:178) ==25885== by 0x8059CE5: ruby_run_node (eval.c:250) ==25885== by 0x8056E54: main (main.c:46) a==25885== ==25885== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 19 from 1) ==25885== malloc/free: in use at exit: 881,496 bytes in 7,028 blocks. ==25885== malloc/free: 7,126 allocs, 98 frees, 896,747 bytes allocated. ==25885== For counts of detected errors, rerun with: -v ==25885== searching for pointers to 7,028 not-freed blocks. ==25885== checked 649,704 bytes. ==25885== ==25885== LEAK SUMMARY: ==25885== definitely lost: 0 bytes in 0 blocks. ==25885== possibly lost: 68 bytes in 1 blocks. ==25885== still reachable: 881,428 bytes in 7,027 blocks. ==25885== suppressed: 0 bytes in 0 blocks. ==25885== Reachable blocks (those to which a pointer was found) are not shown. ==25885== To see them, rerun with: --show-reachable=yes -- [田中 哲][たなか あきら][Tanaka Akira]