Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 642667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:11:53+00:00 2026-05-13T21:11:53+00:00

I am using a DataGridView control in my app at the moment and I

  • 0

I am using a DataGridView control in my app at the moment and I am hitting a weird memory issue with it. I am not using DataBinding at all, just manual population. The data that I am putting in there is not a lot at all. We’re talking about 20 rows by 20 columns of data at the most usually.

The work flow for that control is that I have a ComboBox with different “data sets” that I load as you pick them. So a common usage scenario is cycling through the data sets in the comboBox and seeing them render in the dataGrid. What I am seeing is that when people cycle through the data sets, the app memory usage jumps from 100MB to 1100MB instantly and then drops back down when GC kicks in. But if you cycle through the data sets quickly (i.e. faster than the GC kicks in), you will run out of memory and the app will die.

After debugging, I found that the MAIN reason the memory jumps up like crazy is that I have some columns in that datagrid that are of Image Type. I use them to display a 16×16 icon that indicates status for that row. These icons are stored in an ImageList and I just set them as the value for that cell as I populate the rows of the data grid. If I take out the images and replace them with simple text, I see absolutely no memory spikes whatsoever.

So what is the deal here? Why do images, tiny 16×16, cause the control to go crazy on my with memory like that?

More info:

My logic as you switch data sets is:

  • Clear all the grid rows: dataGrid.Rows.Clear();
  • Clear all the columns: dataGrid.Columns.Clear();
  • Add the columns to the dataGrid control: (most type string, and some DataGridViewImageColumn)
  • Add the data I have row by row using dataGrid.Rows.Add(object[] data); (the data includes the images I need to use as icons).
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T21:11:54+00:00Added an answer on May 13, 2026 at 9:11 pm

    The DataGridView control is meant to work with DataBinding. If you’re not using DataBinding at all, I suggest you use a ListView control.

    The ListView is optimized to displaying images. Furthermore, it is lighter in memory to instantiate than the DataGridView. Plus, the ListView control lets you change your view:

    1. ListView.View = View.Details;
    2. ListView.View = View.LargeIcons;
    3. ListView.View = View.List;
    4. ListView.View = View.SmallIcons;
    5. ListView.View = View.Tile.

    These are the views you may experience within your Windows Explorer. Only only have to define yourself a LargeIcons ImageList, or a SmallIcons ImageList, or one of each, depending on the View you will allow for your user to see.

    You may also display the GridLines as if it were a DataGridView, just to give the same aspect.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a windows form where I am using DataGridView control. It is bind
I was wondering if when using the datagridview control you can remove the thing
Friends, I'm using a datagridview control in my visual studio 2005 windows application. Here
I'm using c#2.0 and WinForms. I have a datagridview control, unbound, loading small amounts
I am using a DataGridView control in a VB.Net application where columns are being
I am using a Datagridview control on winform and a bindingsource for data. Data
I am using a SQlite database connected to datagridview control. Now, I am able
I am using a drop-down list in DataGridView control, but the problem is that
I am using C# winform's DataGridView control to display data present in a table
I am using a DataGridView control in a Windows Forms application. When a user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.