Skip to content

Instantly share code, notes, and snippets.

View benoittgt's full-sized avatar
🏳️‍🌈

Benoit Tigeot benoittgt

🏳️‍🌈
View GitHub Profile
@benoittgt
benoittgt / server.rb
Created July 11, 2024 11:40 — forked from leandronsp/server.rb
HTTP server using Ractors (Ruby 3)
require 'socket'
@queue = Ractor.new do
loop do
Ractor.yield(Ractor.receive, move: true)
end
end
listener = Ractor.new(@queue) do |queue|
socket = TCPServer.new(PORT)
@benoittgt
benoittgt / README.md
Created March 21, 2017 15:56 — forked from wvengen/README.md
Ruby memory analysis over time

Finding a Ruby memory leak using a time analysis

When developing a program in Ruby, you may sometimes encounter a memory leak. For a while now, Ruby has a facility to gather information about what objects are laying around: ObjectSpace.

There are several approaches one can take to debug a leak. This discusses a time-based approach, where a full memory dump is generated every, say, 5 minutes, during a time that the memory leak is showing up. Afterwards, one can look at all the objects, and find out which ones are staying around, causing the