Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

memory grow rapidly

Posted on 2007-03-27
9
Medium Priority
?
412 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
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 120 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 120 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

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
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…
Integration Management Part 2
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

971 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