I have DataGridView
in my project and a timer refresh of 5 seconds. I realized that the system was overloading the memory, because every time I list the previous data, they remain in memory. This is the code I use to list:
Using (DBEntities db = new DBEntities())
{
Dgv_Os.Datasource = null;
List <OS> ostecnicos = (from o in db.OS select o).toList ();
Dgv_Os.Datasource = ostecnicos;
}
What methods to optimize code to make your system lighter?