I have a C# WinForm Application that updates and select from a MySQL database too frequently (about 500 request per minute). It is a simple application that listens to Websocket events and update the MySql db accordingly, I tried testing the application with MSSQL and it was fine.
The problem is that the memory usage keeps adding-up, I tried disabling MySQL Pooling, and all the connections and commands are being used with using (as i know, this should dispose the connections and commands) but still having the same problem.
Do you have any suggestions for me?
cs="server=localhost;userid=root;password=password;database=dbmcf;"
try
{
using (var con = new MySqlConnection(cs))
{
con.Open();
var sql = "select id,login,is_active from user";
using (var cmd = new MySqlCommand(sql, con))
{
using (MySqlDataReader rdr = cmd.ExecuteReader())
{
while (rdr.Read())
{
UserModel model = new UserModel();
model.Id = rdr.GetInt32(0);
model.Login = rdr.GetString(1);
model.Active = rdr.GetBoolean(2);
lstUser.Add(model);
}
rdr.Close();
cmd?.Dispose();
}
}
con.Close();
}
}
catch { }
}