Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stefan-mees/5037928 to your computer and use it in GitHub Desktop.
Save stefan-mees/5037928 to your computer and use it in GitHub Desktop.
Track down memory leak with falcon patch
p `cat /proc/#{Process.pid}/status | grep VmRSS`
"VmRSS:\t 30256 kB\n"
100_000.times {String.public_instance_methods}
GC.start
p `cat /proc/#{Process.pid}/status | grep VmRSS`
"VmRSS:\t 625820 kB\n"
==11283== 14,658,432 bytes in 2,356 blocks are definitely lost in loss record 17,143 of 17,143
==11283== at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11283== by 0x4EB242C: ruby_xcalloc (in /home/ubuntu/.rvm/rubies/ruby-1.9.3-p385-valgrind/lib/libruby.so.1.9.1)
==11283== by 0x4F54E82: sa_init_table (in /home/ubuntu/.rvm/rubies/ruby-1.9.3-p385-valgrind/lib/libruby.so.1.9.1)
==11283== by 0x4F55292: resize.part.4 (in /home/ubuntu/.rvm/rubies/ruby-1.9.3-p385-valgrind/lib/libruby.so.1.9.1)
==11283== by 0x4F54F8E: sa_insert (in /home/ubuntu/.rvm/rubies/ruby-1.9.3-p385-valgrind/lib/libruby.so.1.9.1)
==11283== by 0x4E7C42C: method_entry_i (in /home/ubuntu/.rvm/rubies/ruby-1.9.3-p385-valgrind/lib/libruby.so.1.9.1)
==11283== by 0x4F55606: sa_foreach (in /home/ubuntu/.rvm/rubies/ruby-1.9.3-p385-valgrind/lib/libruby.so.1.9.1)
==11283== by 0x4E80153: class_instance_method_list (in /home/ubuntu/.rvm/rubies/ruby-1.9.3-p385-valgrind/lib/libruby.so.1.9.1)
==11283== by 0x4FB823D: vm_call_method (in /home/ubuntu/.rvm/rubies/ruby-1.9.3-p385-valgrind/lib/libruby.so.1.9.1)
==11283== by 0x4FACB45: vm_exec_core (in /home/ubuntu/.rvm/rubies/ruby-1.9.3-p385-valgrind/lib/libruby.so.1.9.1)
==11283== by 0x4FB33EE: vm_exec (in /home/ubuntu/.rvm/rubies/ruby-1.9.3-p385-valgrind/lib/libruby.so.1.9.1)
==11283== by 0x4FB4480: invoke_block_from_c (in /home/ubuntu/.rvm/rubies/ruby-1.9.3-p385-valgrind/lib/libruby.so.1.9.1)
==11283== by 0x4FB50A0: rb_vm_invoke_proc (in /home/ubuntu/.rvm/rubies/ruby-1.9.3-p385-valgrind/lib/libruby.so.1.9.1)
==11283== by 0x4FB823D: vm_call_method (in /home/ubuntu/.rvm/rubies/ruby-1.9.3-p385-valgrind/lib/libruby.so.1.9.1)
==11283== by 0x4FACB45: vm_exec_core (in /home/ubuntu/.rvm/rubies/ruby-1.9.3-p385-valgrind/lib/libruby.so.1.9.1)
@johnl
Copy link

johnl commented Mar 6, 2013

I can reproduce this memory leak with version of the patch going back to 1.9.3-p327 (it definitely isn't present in builds without the patch)

@funny-falcon
Copy link

It were fixed at 2013-03-11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment