From: Qi Lu Date: 2009-06-22T22:22:11+09:00 Subject: [ruby-core:23968] [Bug #1677] memory leak in DBD-mysql Bug #1677: memory leak in DBD-mysql http://redmine.ruby-lang.org/issues/show/1677 Author: Qi Lu Status: Open, Priority: Normal ruby -v: 1.8.6 I found a serious memory leak in my Ruby code, then I narrow it down and found that there is leak in dbd-mysql. The ruby version is 1.8.6 and dbd-mysql is 0.4.2. it wrote a test code and run in windows XP/Vista/2003, it leaks in all OS, about 3M/day. Here is my test code: require 'dbi' connection = DBI.connect("DBI:Mysql:localhost;database=leaktest;port=3306, leaktest, kael4") i = 1 name = 'test' while true do value = name + i.to_s sql = "insert into test (name) values ('#{value}');" sth = connection.execute(sql) sleep 0.5 sth.finish sleep 0.5 i += 1 end make sure to setup database, here are the statement: mysql> create database leaktest; mysql> create table test ( ID int(11) NOT NULL auto_increment, name varchar(20) not nul l, CONSTRAINT PK_test_id PRIMARY KEY (ID) ); mysql> grant select,update,insert,delete,execute,create,drop,alter on SkyMsgs.* to SkyM sgs@localhost identified by 'MsgsSky'; This test only do simply insertion operation in MySQL. Best regards, Qi ---------------------------------------- http://redmine.ruby-lang.org