Created
December 11, 2008 14:41
-
-
Save NZKoz/34732 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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