On 08/30/2010 03:22 PM, Jeremy Evans wrote:
On Aug 30, 3:00 pm, Joel VanderWerf<[email protected]> wrote:
There's probably something seriously wrong with the following code. It
leaks one instance of Sequel::SQLite::Database per iteration. (Well,
it's actually not a leak, since the instance is available via
ObjectSpace.) Is there something else I should be doing to tell Sequel
(or SQLite?) to release the instance so it can be collected?
require 'sequel'
filename = "test.sqlite"
loop do
sleep 1
db = Sequel.sqlite(filename)
db.disconnect
p ObjectSpace.each_object(Sequel::SQLite::Database) {}
end
That's expected behavior. Use the block form if you don't want to
leak, or manually remove the cached connections from
Sequel::DATABASES. This is mentioned in the documentation for
Sequel::DATABASES (http://sequel.rubyforge.org/rdoc/classes/
Sequel.html).
Thanks!
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en.