DataGridView and Memory

joe_pool_is

Contributor
Joined
Jan 18, 2004
Messages
507
Location
Longview, TX [USA]
I've built an application that reads data from a table, and populates that data into a series of DataGridView (DGV) controls.
Code:
DataTable table = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(sqlText, sqlConnection);
da.Fill(table);
DataGridViewX.DataSource = table.DefaultView();
Simple.

There is a lot of data, so I've had to limit the amount that I read in, because I can quickly exceed WinXP's 2GB per user limit. In Task Manager, I can see that my App takes up about 17MB (megabytes) while at the IDE, jumps to roughly 24MB in debug mode, then quickly approaches my limit as I pull in data from tables.

What I'm working on to keep pulling in data is to take each table and export it to an Excel file in the next (unshown) line of code. For now, the DGV controls are still there.

Here's the interesting part: Say I pull in 7 tables (which I did recently), populate 7 different DGV controls and create 7 different Excel files. It all works, but Task Manager now shows that my App is at about 1.7GB whereas the folder where I saved the Excel files shows that all 7 files only add up to about 25MB.

Why are the DGV controls so bloated? I know they are powerful and fast, but does this mean they store multiple versions of the data in memory or something?
 
Back
Top