Jason Nesbitt

Jason Nesbitt

  • NA
  • 13
  • 13.4k

Dataset copy() memory leak

May 11 2011 6:26 AM
Hi

I have an application that needs to frequently backup a dataset and revert to that backup if the users decides to cancel an action.

There is a global dataset created at the top of the class:

DataSet database = null;

Every time a form is opened the main dataset is copied into the created variable:

database = AppModel.Instance.Data.Data.Copy();

The problem is that every time the form is opened the memory increases by quite a lot and is never released.

I've tried disposing the database variable after it's been used but the memory still remains high - This has left me to believe that the DataSet.Copy() method allocates to new memory every time.

Any suggestions to free up the memory would be greatly appreciated.

Regards,

Jason

Answers (5)