开发者

Release Memory in Work with Datasets

开发者 https://www.devze.com 2023-03-18 02:16 出处:网络
I load some data from SQL server into 开发者_如何转开发a DataSet. When I close the form my DataSet is not releasing memory!
  1. I load some data from SQL server into 开发者_如何转开发a DataSet.
  2. When I close the form my DataSet is not releasing memory!

How Can I Fix this problem?


It is hard to answer your question as you did not post your code. Perhaps, this memory leak is caused by the fact that this dataSet is referenced on another form or there are event handlers.... To find memory leaks, I would suggest that you try the .NET Memory Profiler. Finally, to explicitly clear the DataSet, use its Dispose method.


You have a live reference to your DataSet.
You need to figure out what is still referencing the DataSet and clear the reference.


First of all make sure there is no reference to your data set, also make sure after you are done with the dataset you call the dispose method (or put your data set in a using block)

0

精彩评论

暂无评论...
验证码 换一张
取 消