Skip to content

Instantly share code, notes, and snippets.

@NZKoz
Created December 11, 2008 14:41
Show Gist options
  • Save NZKoz/34732 to your computer and use it in GitHub Desktop.
Save NZKoz/34732 to your computer and use it in GitHub Desktop.
def Session::callback(dbman) #:nodoc:
Proc.new{
dbman[0].close unless dbman.empty?
}
end
def initialize(request, option={})
#blah blah
@dbprot = [@dbman]
ObjectSpace::define_finalizer(self, Session::callback(@dbprot))
end
class Hax
def self.callback(obj)
Proc.new do
puts obj.inspect if obj
end
end
def initialize
@hax = "asdf"
ObjectSpace::define_finalizer(self, Hax.callback(@hax))
end
end
class HaxController
def initialize
@hax = Hax.new
@hax = Hax.new
@hax = Hax.new
end
end
loop do
500_000.times do
HaxController.new
end
puts "run"
sleep 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment