I have noobishly written an ASP.Net without any Dispose methods for unmanged objects. The object I am using are Sqlconnection, Sqlcommand and SqlDataReader. My application on my shared host shows very high resource usage, and I'm the only one using it. Which seems to me like a badly designed app. Because it's done in C# ASP.Net 3.5 the garbage collection should handle managed objects without my intervention correct? But it doesn't handle unmanaged objects I think.
So I had a look at FxCop and ran it on my app. But it is coming up with no error for "Implements IDisposable correctly" in my whole app. This seems odd since I have not used the Dispose method once. So here is a section of my code for example. Is this code leaking memory? most of my code is the same with different params tables etc.
public List<Classy> Get_Classy(int classyId)
List<Classy> classyList = new List<Classy>();
using (SqlConnection connection = new SqlConnection(connStr))
SqlCommand command = new SqlCommand();
command.CommandText = "SELECT * FROM ClassyStore WHERE classyId = @classyId";
command.CommandType = CommandType.Text;
command.Connection = connection;
View Complete Post