Hossein Moradinia
Hossein Moradinia

Reputation: 6244

Release Memory in Work with Datasets

  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?

Upvotes: 1

Views: 2524

Answers (3)

Manatherin
Manatherin

Reputation: 4187

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)

Upvotes: 1

platon
platon

Reputation: 5340

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.

Upvotes: 1

SLaks
SLaks

Reputation: 887887

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

Upvotes: 1

Related Questions