MySQL Forums
Forum List  »  Newbie

Mysql Memory Problem, pls help
Posted by: shenhf
Date: August 07, 2004 04:41AM

I used mysql c api to create a db application, but I meet the memory problem: the application need more and more memory,and last got "[2004/08/07 15:44:26]---Mysql query Error: (MySQL client run out of memory)
sql=[select * from ltsend WHERE Status = '0' limit 0, 30]" error. I add the reconnect statement:
//Recreate mysql connection
mysql_close (sock_mt);
log_message(LOG_FILE, "Reconnecting ...");
mysql_init (&mysql_mt);
if (!(sock_mt = mysql_real_connect (&mysql_mt, NULL, dbuser, dbpass, dbname, 0, NULL, 0)))
{
sprintf(log_msg, "Reconnect to DB Error:%s, Application Aborted!", mysql_error(&mysql_mt));
log_message(LOG_FILE, log_msg);
exit(-1);
}
log_message(LOG_FILE, "Reconnecting OK...");
and the error still exists:
[2004/08/07 15:44:26]---Mysql query Error: (MySQL client run out of memory)
sql=[select * from ltsend WHERE Status = '0' limit 0, 30]
[2004/08/07 15:44:26]---Reconnecting ...
[2004/08/07 15:44:26]---Reconnecting OK...
[2004/08/07 15:44:28]---Mysql query Error: (MySQL client run out of memory)
sql=[select * from ltsend WHERE Status = '0' limit 0, 30]
[2004/08/07 15:44:28]---Reconnecting ...
[2004/08/07 15:44:28]---Reconnecting OK...
[2004/08/07 15:44:29]---Mysql query Error: (MySQL client run out of memory)
sql=[select * from ltsend WHERE Status = '0' limit 0, 30]
[2004/08/07 15:44:29]---Reconnecting ...

the only way is to kill the process and restart the application.

the top show :
PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
2843 mysql 16 0 13408 13M 1108 R 35.9 1.3 154:14 0 mysqld
2155 mysql 16 0 13408 13M 1108 S 14.3 1.3 70:52 0 mysqld
2860 mysql 15 0 13408 13M 1108 R 8.7 1.3 37:00 0 mysqld
4438 mysql 16 0 13408 13M 1108 S 2.9 1.3 4:01 0 mysqld
2152 root 15 0 103M 103M 740 S 0.1 10.4 0:06 0 yd

It tells my application yd now 103M, and it will grow to about 200M and got the error


Pls help

Options: ReplyQuote


Subject
Written By
Posted
Mysql Memory Problem, pls help
August 07, 2004 04:41AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.