ASP.NET service runs out of memory when using Crystal Reports

A

andrew.roberts

I know there have been similar threads already on this subject but I
thought I create my own so I could state the particulars of my problem.

We have a W2K (SP4) running ASP.NET v1.1 and the Crystal Reports XI
runtime. This server hosts a number of web reports created using a
mixture of .NET and Crystal with a SQL Server 2000 server in the
background providing the data for the reports via stored procedures.
Now everything is fine for a while until a user tries to access a
report and instead gets an 'Server out of memory' error.

While I believe I have done everything to clear down all resources used
(i.e. calling dispose/ close methods for database objects) it looks
like I still have memory leak. In the Global.asax under the
Application_end method I have coded in Session.Clear and
Session.Abandon method calls to clear out the Session object.

The only thing I dont explicitly dispose of is the Crystal Reports
objects because when the page is refreshed to show the report, it does
so by binding the viewer to the report object stored in the Session
object. If I didnt store the report in the Session object then when the
page reloaded no report would be shown.

Am I doing something fundamentally wrong? Any help would be
appreciated. Thanks.
 
G

Guest

I was having the same problem. The virtual memory was spiking on the server
at 350 meg when the reports ran and that caused a virtual memory violation.
We modified the machine.config file to allow for more memory and things have
been okay since.

I would highly recommend disposing of the report. My pages reload the
report every time the page loads.
Dim crPath As String
Protected WithEvents crViewer1 As CrystalDecisions.Web.CrystalReportViewer

Dim crReportDocument As New
CrystalDecisions.CrystalReports.Engine.ReportDocument

crPath = Server.MapPath("TestRpt.rpt")
crReportDocument.Load(crPath)
'Create a new instance of the connectioninfo object and set the
porperties
crConnectionInfo = New ConnectionInfo
With crConnectionInfo
.ServerName = "sqlserver name"
.DatabaseName = "database name"
.UserID = "User"
.Password = "@@@@@@@@"
End With

'Get the tables collection from the report object
crDatabase = crReportDocument.Database
crTables = crDatabase.Tables
'Apply the logon information to each table in the collection
For Each crTable In crTables
crTableLogOnInfo = crTable.LogOnInfo
crTableLogOnInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTableLogOnInfo)
Next
'Once the connection to the database has been established for each
table in
'the report, the report object can be bound to the viewer using the
'reportsource property of the viewer to display the report.
crViewer1.ReportSource = crReportDocument

I put the dispose in the unload_page routine and that fixed the maximum user
threshold problem I was having.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top