I have an unbound datagridview with 175 columns and 50,000 rows, populated primarily with doubles. According to my calculations, this equates to a memory usage of 175*50000*8 bytes = 70 MB. However, Task Manager says the grid is using about 1.2 GB of memory – an 17x overhead! Can anyone explain why it’s consuming so much memory?
From the msdn article on scaling the datagridview ( http://msdn.microsoft.com/en-us/library/ha5xt0d9.aspx ) I don’t think I’m doing anything flagrantly wrong. I’m not setting styles or contextmenustrips for individual cells. No modifications other than populating the cell values and setting format strings on column level.
I understand that virtual mode or shared rows might decrease memory consumption, but given my above calculations, I don’t think it should be necessary. 17x overhead doesn’t sound right to me.
Keep in mind that each cell of your DataGridView holds a DataGridViewCell instance, containing about 33 properties. It’s more overhead than just a
doublevalue.