MySQL question - memory leaks. how to resolve?
Posted on 2006-11-08
dev env = VS C# .Net 2003
version = MySQL 5.0.27-community-nt via named pipe
connector = MySQL Connector Net 1.0.8
admin = MySQL Admin 1.2.5 rc
My C# app has memory leaks. From the App.. I make function calls to referenced C++ dlls from inside the VS C# .Net env, however I'm confident that the leaks are not because of C++ code in the dlls not releasing memory. I reset objects to null and make use of garbage collection fairly well.. so.. I think the problem is with MySQL because recently... after re-installing MySQL to the latest version 5.0.27 I noticed that the pagefile was reduced by 50% at the startup of the app... which was a nice surprise. Not sure if I just changed the settings, thus causing the reduction.. but in any case..
After startup, it is my gut feeling that MySQL is causing the pagefile to grow 2 to 4 MB every few secs. I would gladly post my database connectivity code if that would help to find a solution, however for the time being, can anyone direct me to links, or documentation that can help me troubleshoot leaks when running MySQL in the .Net environment?
I make attempts to release the connection where i think it's necessary as follows:
public virtual void releaseConnection(MySqlConnection connection)
catch (Exception ex)
Note: In the Task Manager, when machine is at rest.. with no Apps running.. MySQL looks as follows:
Image Name Mem Usage VM Size Handles Threads
mysqld-nt.exe 15,392 K 84,9565 K 4,457 15
The mysqld-nt.exe stays relatively the same size, however.... when my VS C# App is then running, the App's exe continues to grow in size, possibly because I'm not using MySQL properly in order for the garbage collection to release memory that MySQL is utilizing. Any input appreciated here. More specific info can be provided upon request. Thanks.