Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Memory Utilization Problem in .NET

Posted on 2004-11-01
10
Medium Priority
?
158 Views
Last Modified: 2010-04-24
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
0
Comment
Question by:fahimnxb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 10

Accepted Solution

by:
prakash_prk earned 800 total points
ID: 12462982

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
 
LVL 10

Expert Comment

by:prakash_prk
ID: 12463015
http://www.scitech.se/memprofiler/Default.htm

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

Regards
Prakash

0
 
LVL 8

Assisted Solution

by:wguerram
wguerram earned 400 total points
ID: 12465361
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Assisted Solution

by:farsight
farsight earned 400 total points
ID: 12500734
[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
 
LVL 5

Author Comment

by:fahimnxb
ID: 12613895
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
 
LVL 10

Expert Comment

by:prakash_prk
ID: 12613929

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

full objects list ?
0
 
LVL 12

Expert Comment

by:farsight
ID: 12616967
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
 
LVL 8

Expert Comment

by:wguerram
ID: 12617055
But something is not good, since this is causing the application become slow.
0
 
LVL 5

Author Comment

by:fahimnxb
ID: 12621993
Exactly application is getting slow and GC.Collect is not collecting memory properly.

Objects are DataAdapter, SqlConnection, DataSet etc.


Regards,
Me
0
 
LVL 8

Expert Comment

by:wguerram
ID: 12624887
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

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question