search for: define_finalizer

Displaying 4 results from an estimated 4 matches for "define_finalizer".

2006 Oct 24
1
Broken thread Safe connection Management on Mysql (Mysql too many connections errors)
...l socket are not closed In my humble opinion there are two reasons for it: - ActiveRecord::Base.allow_concurrency = true That will make every thread open it''s own socket to mysql - Mysql adapter implementations (RAILS or gems) that close connection on Garbage connexion (using ObjectSpace.define_finalizer ) There is probably a memory leak on connections as the Proc finalizer is not be executed when worker thread is killed (= connections are not GC). In this case the only way to release the sockets is to close the backgroundrb daemon. Those two phenomenons lead to an accumulation of opened soc...
2006 Feb 20
0
Object Finalizers help
Heya guys, This one is bothering me as its evading my eye. I''m trying to set a callback on finalization of an object, ie: a finalizer set through a plugin to the model. Example In Plugin: def acts_as_goat class_eval do ObjectSpace.define_finalizer(self, Proc.new {self.conn.close} ) end end class UberGoat < ActiveRecord::Base acts_as_goat end Anyways, it seems to not be calling the finalizer? Is this the correct way to set a finalizer or am I going about it the wrong way. I need to close a socket connection _after_ the model is...
2006 Feb 20
1
Object finalization help
Heya guys, This one is bothering me as its evading my eye. I''m trying to set a callback on finalization of an object, ie: a finalizer set through a plugin to the model. Example In Plugin: def acts_as_goat class_eval do ObjectSpace.define_finalizer(self, lambda {self.conn.close} ) end end class UberGoat < ActiveRecord::Base acts_as_goat end Is this the correct way to set a finalizer or am I going about it the wrong way. I need to close a socket connection _after_ the model goes out of scope where GC usually happens. Do models get G...
2005 May 08
1
ruby destructor hooks
...rs list. When an event is broadcast, its "notify" method is called, it gives a "pure virtual method call" error (wxruby 0.6.0). I''ve tried several different things to clean up the subscribers list as controls are destroyed, but without success: WeakRef ObjectSpace.define_finalizer(subscriber) subscriber.evt_close() { | e | delete_subscriber(subscriber) } The last seems to be the most promising, but it doesn''t work for all the control types that can be subscribers - only for frames. Is there something universal to all Wx controls that I could try? cheers alex