DataGridView memory problem

0
0

when i set a datagridview  data soruce 500.000 row memory usage up 2GB , w3wp.exe over of 5GB application is very very slow  ,  When I close a window ı set closed event

mylist=null

Dispose(true);
GC.Collect();
GC.SuppressFinalize(true);

But just 100 mb down memory usage

what can i do to solve this problem?

Thanks

  • You must to post comments
1
0

Half a million rows is a lot of data to manage and display and will use lots of memory, but:

See attached video and sample.

https://drive.google.com/file/d/1vFRCca_ahUQVwGa-mB-e1x5g3ilny9Dq/view

The sample loads 500K rows x 10 columns and uses about 480MB and when cleared it goes down to zero (11MB, which is where it started at). Half a million row is a lot of data and they do use memory but with VirtualMode you can feed the data to each cell virtually, meaning that you can load/discard the data in chunks, or load it from disk or from the database. It saves all the memory needed for the data since it’s just returned to the client and just for the visible rows.

However, 480MB is still a lot of memory and we have an enhancement for 2.2 (virtual rows) that will bring it down in a case like this to about 4MB!

For the memory not going down, don’t use GC.SuppressFinalize(true) and let the GC do it’s work. If the objects are not referenced they will be released by .NET. If they are not released it means that your data source is referenced somewhere in the app.

If you want to send a small sample I can take a look.

Attachment
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.