How do you force a DataGridView to release its reference to a bound DataSet?
We have a rather large dataset being displayed in a DataGridView and noticed that resources were not being freed after the DataGridView was closed. If the user repeatedly views this report they eventually get an out of memory exception. ANTS Memory Profiler confirmed that the DGV is holding a reference despite dgv.DataSource
being set to null.
Do you have any events registered on the DataGridView like OnClick? Make sure you unregister all events, otherwise it will not be garbage collected
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With