Skip to content

Instantly share code, notes, and snippets.

@matthewd
Created October 8, 2016 05:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewd/dd9d0f853991a3cf2fabc25b21ca43ff to your computer and use it in GitHub Desktop.
Save matthewd/dd9d0f853991a3cf2fabc25b21ca43ff to your computer and use it in GitHub Desktop.
% valgrind --tool=memcheck --max-stackframe=8382448 --track-origins=yes /home/matthew/.rbenv/versions/compiled/bin/ruby ./test.rb
==8880== Memcheck, a memory error detector
==8880== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==8880== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==8880== Command: /home/matthew/.rbenv/versions/compiled/bin/ruby ./test.rb
==8880==
........==8880== Thread 124 test.rb:7:
==8880== Syscall param read(buf) points to unaddressable byte(s)
==8880== at 0x4E4A55D: ??? (syscall-template.S:84)
==8880== by 0x15D610: internal_read_func (io.c:948)
==8880== by 0x29427C: rb_thread_io_blocking_region (thread.c:1414)
==8880== by 0x15D6F2: rb_read_internal (io.c:982)
==8880== by 0x15EBAE: io_fillbuf (io.c:1770)
==8880== by 0x16268B: io_getc (io.c:3532)
==8880== by 0x163116: rb_io_getc (io.c:3778)
==8880== by 0x26B2B1: call_cfunc_0 (vm_insnhelper.c:1469)
==8880== by 0x26BD26: vm_call_cfunc_with_frame (vm_insnhelper.c:1642)
==8880== by 0x26BE46: vm_call_cfunc (vm_insnhelper.c:1737)
==8880== by 0x270D51: vm_exec_core (insns.def:994)
==8880== by 0x282499: vm_exec (vm.c:1650)
==8880== Address 0x87ca850 is 0 bytes inside a block of size 8,192 free'd
==8880== at 0x4C2EDEB: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8880== by 0x1513E2: objspace_xfree (gc.c:7704)
==8880== by 0x15172B: ruby_sized_xfree (gc.c:7793)
==8880== by 0x15174B: ruby_xfree (gc.c:7800)
==8880== by 0x1641B3: free_io_buffer (io.c:4285)
==8880== by 0x164120: fptr_finalize (io.c:4265)
==8880== by 0x164189: rb_io_fptr_cleanup (io.c:4277)
==8880== by 0x164452: io_close_fptr (io.c:4366)
==8880== by 0x1644BC: rb_io_close (io.c:4384)
==8880== by 0x164519: rb_io_close_m (io.c:4412)
==8880== by 0x26B2B1: call_cfunc_0 (vm_insnhelper.c:1469)
==8880== by 0x26BD26: vm_call_cfunc_with_frame (vm_insnhelper.c:1642)
==8880== Block was alloc'd at
==8880== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8880== by 0x1511C8: objspace_xmalloc (gc.c:7648)
==8880== by 0x1514A4: ruby_xmalloc2 (gc.c:7728)
==8880== by 0x15EB71: io_fillbuf (io.c:1762)
==8880== by 0x16268B: io_getc (io.c:3532)
==8880== by 0x163116: rb_io_getc (io.c:3778)
==8880== by 0x26B2B1: call_cfunc_0 (vm_insnhelper.c:1469)
==8880== by 0x26BD26: vm_call_cfunc_with_frame (vm_insnhelper.c:1642)
==8880== by 0x26BE46: vm_call_cfunc (vm_insnhelper.c:1737)
==8880== by 0x270D51: vm_exec_core (insns.def:994)
==8880== by 0x282499: vm_exec (vm.c:1650)
==8880== by 0x2803D4: invoke_block (vm.c:921)
==8880==
==8880== Thread 106 test.rb:7:
==8880== Invalid read of size 1
==8880== at 0x1626CA: io_getc (io.c:3535)
==8880== by 0x163116: rb_io_getc (io.c:3778)
==8880== by 0x26B2B1: call_cfunc_0 (vm_insnhelper.c:1469)
==8880== by 0x26BD26: vm_call_cfunc_with_frame (vm_insnhelper.c:1642)
==8880== by 0x26BE46: vm_call_cfunc (vm_insnhelper.c:1737)
==8880== by 0x270D51: vm_exec_core (insns.def:994)
==8880== by 0x282499: vm_exec (vm.c:1650)
==8880== by 0x2803D4: invoke_block (vm.c:921)
==8880== by 0x280796: invoke_block_from_c_0 (vm.c:971)
==8880== by 0x28083A: invoke_block_from_c_splattable (vm.c:988)
==8880== by 0x280986: vm_yield (vm.c:1023)
==8880== by 0x27C2CB: rb_yield_0 (vm_eval.c:1010)
==8880== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==8880==
./test.rb:7: [BUG] Segmentation fault at 0x00000000000000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment