-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #392 from haileys/resultset-close-memory-leak
Always call sqlite3_finalize in deallocate func
- Loading branch information
Showing
3 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require "helper" | ||
|
||
module SQLite3 | ||
# these tests will cause ruby_memcheck to report a leak if we're not cleaning up resources | ||
class TestResourceCleanup < SQLite3::TestCase | ||
def test_cleanup_unclosed_database_object | ||
100.times do | ||
SQLite3::Database.new(':memory:') | ||
end | ||
end | ||
|
||
def test_cleanup_unclosed_statement_object | ||
100.times do | ||
db = SQLite3::Database.new(':memory:') | ||
db.execute('create table foo(text BLOB)') | ||
db.prepare('select * from foo') | ||
end | ||
end | ||
|
||
# def test_cleanup_unclosed_resultset_object | ||
# db = SQLite3::Database.new(':memory:') | ||
# db.execute('create table foo(text BLOB)') | ||
# stmt = db.prepare('select * from foo') | ||
# stmt.execute | ||
# end | ||
end | ||
end |