Bug #6649 Objects not being disposed
Submitted: 15 Nov 2004 23:20 Modified: 16 Nov 2004 14:40
Reporter: Nate Jones Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:1.0.0 Beta OS:Microsoft Windows (Windows XP, Windows 2000 Server)
Assigned to: Reggie Burnett CPU Architecture:Any

[15 Nov 2004 23:20] Nate Jones
Description:
I've been using the ".NET memory profiler" application to track memory leaks in all of my .NET programs, and I've found that the MySQL.Net Data Provider leaks memory like crazy.  You don't notice it a lot on windows forms applications or asp.net applications, because when the application exits, the Garbage Collector cleans up all the memory problems.  However, when you use the MySQL.net Data Provider in a Service application that is always running, and almost never gets closed or restarted, you really start to see the memory leak problems.  .NET Memory profiler shows that the "Packet" objects for .net data provider never get disposed of.  There are a couple of other object that don't get disposed of either, but the biggest problem does seem to be the "Packet" objects.  If the MySQL team could clean up the memory leaks in the MySQL .NET data provider, I would be very appreciative, because of all the memory that I'm losing while using the provider in my Service application.

How to repeat:
Just use the provider in an application, run some queries, and watch the memory never get released.  You can also download and use a .net memory profiler and watch that the "Packet" objects and a few others never get disposed of.

Suggested fix:
Dispose of all the objects that don't get disposed of.
[16 Nov 2004 14:40] Reggie Burnett
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

This has been significantly improved in 1.0.2.

Thanks for the post.