# Invalid read of size 4: valgrind ./ruby -ve 'print "a"'

**URL:** <https://www.ruby-forum.com/t/invalid-read-of-size-4-valgrind-ruby-ve-print-a/108849>\
**Category:** Development\
**Created:** [July 8, 2007, 2:44am UTC](https://www.ruby-forum.com/t/invalid-read-of-size-4-valgrind-ruby-ve-print-a/108849 "2007-07-08T02:44:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tanaka\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c67d28/32.png) [@Tanaka\_A](https://www.ruby-forum.com/u/Tanaka_A)\
**Post date:** [July 8, 2007, 2:44am UTC](https://www.ruby-forum.com/t/invalid-read-of-size-4-valgrind-ruby-ve-print-a/108849/1 "2007-07-08T02:44:47Z")

</div>

e$B0J2\<$N$h$&$K$9$k$H!"e(Brb\_thread\_alone e$B$Ge(B  
Invalid read of size 4 e$B$K$J$k$h$&$G$9!#e(B

% valgrind ./ruby -ve ‘print “a”’  
==25885== Memcheck, a memory error detector.  
==25885== Copyright © 2002-2006, and GNU GPL’d, by Julian Seward et  
al.  
==25885== Using LibVEX rev 1658, a library for dynamic binary  
translation.  
==25885== Copyright © 2004-2006, and GNU GPL’d, by OpenWorks LLP.  
==25885== Using valgrind-3.2.1-Debian, a dynamic binary instrumentation  
framework.  
==25885== Copyright © 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
