-
August 29th, 2009, 04:30 AM
#1
Why my dataset doesn't release memory!!
Hi all,
I see there are a lot of question about it ...but no way to solve this problem....
In code like :
using (Dataset ds = new dataset())
{
.........some ds stuff................
}
even if
ds.dispose()
or
ds=null
or
GC.Collect()
the memory is not released.
Many thanks
-
August 29th, 2009, 04:57 AM
#2
Re: Why my dataset doesn't release memory!!
This should help explain how a garbage collector works:
http://en.wikipedia.org/wiki/Garbage...ter_science%29
www.monotorrent.com For all your .NET bittorrent needs
NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.
-
August 29th, 2009, 05:04 AM
#3
Re: Why my dataset doesn't release memory!!
I see there are a lot of question about it ...
... and there's a lot of answers about it, like limiting your SQL query or use a DataReader instead or just leaving the GC alone because it's nothing to worry about.
If you REALLY want to force a GC cycle do this outside the using block (after making sure nothing holds a reference to your data set i.e. don't set it as a source on a DataGrid, don't hold it in a member variable) :
Code:
GC.GetTotalMemory(true);
but you shouldn't.
If you need deterministic cleanup of memory use C++.
Darwen.
Last edited by darwen; August 29th, 2009 at 05:07 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|