Solved

memory grow rapidly

Posted on 2007-03-27
9
405 Views
Last Modified: 2013-11-26
I use Visual Studio 2003 (VB.NET) to write a simple program.
In this program, the timer will call a funciton to check records of MSSQL via ADODB and activate Crystal Report 11 to print some document.

However, I found the memory usage for this program is growing rapidly. What seems to be problem ?

I have already close the ADODB.Recordset and set to nothing as well as nothing to CrystalDecisions.CrystalReports.Engine.ReportDocument before exit the funciton !

Cheers,
Andrew
0
Comment
Question by:andrewyu
[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
9 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 18800476
(...my generic answer for this symptom...)

.Net is notorious for having simple apps consume huge amounts of memory...to the alarm of coders who have never seen this before.

The GC (Garbage Collector) works well but doesn't run as often as most people think it should.  In most cases, if the system as a whole needs memory, then the GC will clean up and reduce the footprint of your app.

A quick indication of whether you have an actual memory leak or not, is to see what happens when the app is CLOSED.  If the memory is all reclaimed then you do NOT have a leak and it's just the GC working in a way that you didn't expect.  If you close the app and the memory is not released back to the system then you have a problem.

I've also seen other posts where the cause of the leak was the use of third party controls.
0
 
LVL 21

Expert Comment

by:mastoo
ID: 18800494
0
 

Author Comment

by:andrewyu
ID: 18800766
Is there any way to FORCE the Garbage Collector to clean up the Garbage ?
0
Raise the IQ of Your IT Alerts

From IT major incidents to manufacturing line slowdowns, every business process generates insights that need to reach the people required to take action. You need a platform that integrates with your business tools to create fully enabled DevOps toolchains.

You need xMatters.

 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 30 total points
ID: 18800824
See GC.Collect():
http://msdn2.microsoft.com/en-us/library/xe0c2357.aspx

But calling it too often can have a detrimental effect on your applications speeed!
0
 
LVL 21

Assisted Solution

by:mastoo
mastoo earned 30 total points
ID: 18800924
Here's a good microsoft link:

http://msdn.microsoft.com/msdnmag/issues/06/11/CLRInsideOut/default.aspx

with this relevant quote:

In general it is not recommended that you induce GC collections. In most cases, if # Induced GC indicates a high number, you should consider it a bug. Most of the time people induce GCs in hopes of cutting down the heap size, but this is almost never a good idea. Instead, you should find out why your heap is growing.
0
 
LVL 8

Expert Comment

by:doraiswamy
ID: 18806400
Perhaps you can modify your app so that you do not have to instantiate a new CrystalDecisions.CrystalReports.Engine.ReportDocument everytime you enter the timer event.

By the way, what prompted you to check the memory usage? Did you get any exception?
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

717 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