Hi Guys.
How to avoid memory leak in C# Applications.My Application is consuming lot of Memory Usage while iam running and application is freezing.Can anyabody help in this regard.
Thank You.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Chaitanya Reddy VonajaPosted Nov 15, 2009, 3:58 AM
Thank You.
Kirtan PatelPosted Nov 14, 2009, 1:37 PM
then Solution to your problem is to use MultiThreading [:)]
when you download the data Run the Code for Downloading Data in Separate Thread so your UI will not Freeze [:)]
if you dont know how to Create Thread then
you can start Learning From Below Link
http://www.c-sharpcorner.com/UploadFile/udeshikah/002202009021606AM/0.aspx
and
http://msdn.microsoft.com/en-us/library/aa645740%28VS.71%29.aspx
if my answer helps you then check "Do you like this answer check box" please :)
Lalit MPosted Nov 14, 2009, 1:26 PM
If you are letting .NET to manage memory, it will do a good job of memory management. If you start messing with the Garbage Collector (GC) then you get into big trouble.
.NET's GC does not collect items right away, it lingers around in case the block is needed somewhere else. It collects when it thinks it should.
The Dispose method is used to release unmanaged resources that aren't handled by the garbage collector, like some streams and graphics operations. If you are using these, then you'll want to call the Dispose method when you're done with the object. The object itself will remain in memory until it's collected, but the unmanaged resources associated with it will be freed.
Note: For most streams, the Dispose method will probably be replaced by the Close method, which does the same thing.
Visit this How to Memory Management
Chaitanya Reddy VonajaPosted Nov 14, 2009, 12:05 PM
Kirtan PatelPosted Nov 14, 2009, 12:01 PM