Skip to content

Instantly share code, notes, and snippets.

@l33z3r
Created September 29, 2016 10:08
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 l33z3r/6f783edc6258367d2ef9fa7c2402e666 to your computer and use it in GitHub Desktop.
Save l33z3r/6f783edc6258367d2ef9fa7c2402e666 to your computer and use it in GitHub Desktop.
Memory Leak With RabbitMQ (3.2.4) and Bunny Gem (2.5.1) On Ruby. Ubuntu
#!/usr/bin/env ruby
require 'bunny'
require 'pry'
puts 'Connecting...'
conn = Bunny.new
conn.start
channel = conn.create_channel
queue = channel.queue('hello')
puts 'Connected...'
fork do
loop do
queue.publish('Sample Message')
end
conn.close
end
queue.subscribe(:block => true) do |_delivery_info, _properties, body|
puts "Received #{body}"
# imitate some work
a = 0
(1..100_000).each do |num|
a = a + 1
end
end
conn.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment