Solved

memory grow rapidly

Posted on 2007-03-27
9
404 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 85

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
Independent Software Vendors: 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 85

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

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!

Question has a verified solution.

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

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

749 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