Memory Utilization Problem in .NET

Dear Experts,

According to .net documentation, Garbage Collector should free the memory. we analysed and found following things.

1- We have 40 modules in window desktop application in VB.net. Every module opening adds 1 or 2 MB to Memory utilization statistics displayed in Task Manager. Now see, a user was engaged in public sector dealing. He has to open forms 100 times a day and has to perform different tasks. Continuous addition to memory causes application to become slower. User has to shutdown Application and then restarts if he needs to free Memory which is not acceptable.  

Please Advice...we have tried to destroy objects explicitly and we have call system.GC.Collect also with that.......but no improvement

Regards,
Fahim
LVL 5
fahimnxbAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

prakash_prkCommented:

Destroy all the objects
Clear the content in treeview befor destroy it
if you have image lists clear the images before destroy it
If you have webbrowser control navigate it to "about:blank" and destroy it

After destroy all the objects
call
GC.Collect()
GC.WaitForPendingFinalizers()

Regards
Prakash
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
prakash_prkCommented:
http://www.scitech.se/memprofiler/Default.htm

Try this memory profiles to find the leaks, unremoved instanes .

Regards
Prakash

0
wguerramCommented:
Do you have public varaibles?

If there is an reference to the an object the GC won't collect the memory.

What type of application is yours? do you play alot with images? data?
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

farsightCommented:
[nitpick]

>  Continuous addition to memory causes application to become slower

To me, this sounds like a conclusion rather than a fact.
Investigate what leads you to believe that additional memory used by your application is the CAUSE of it becoming slower.
0
fahimnxbAuthor Commented:
Ya data loaded in memory is too large, after destroying all objects , data sets adapter etc. And also calling
GC.Collect()
GC.WaitForPendingFinalizers()
memory is not recovered.

Eg
used memory before execution 100Mb
used memory after execution 450Mb
used memory after destroying all objects 350MB

dats the story.

Regards,
me

0
prakash_prkCommented:

can you say which types of objects you have in your project ?

full objects list ?
0
farsightCommented:
That's really not a problem.

GC.Collect is like cleaning your house.  It moves everything to the proper place, but it doesn't make your house smaller.
To get your house smaller, .NET will release some of your application's memory when the system becomes memory constrained.  But it there's plenty of memory, it will leave your house (your application) large.
0
wguerramCommented:
But something is not good, since this is causing the application become slow.
0
fahimnxbAuthor Commented:
Exactly application is getting slow and GC.Collect is not collecting memory properly.

Objects are DataAdapter, SqlConnection, DataSet etc.


Regards,
Me
0
wguerramCommented:
What version of visual studio are you using?

are you closing the connections when the forms are being closed or disposed?

how many forms do you have in your application?

have you noticed if an specific form that is causing the problem or all the forms cause the problem?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.