cancel
Showing results for 
Search instead for 
Did you mean: 

Out Of Memory & Invalid Pointer exceptions on CSV export

Former Member
0 Kudos

Iu2019m having problems when exporting more than 1 million rows of data to a CSV format. Iu2019m running the export from C# code (see sample code below). Depending on the template that I use, I get either a System.OutOfMemoryException or a System.Runtime.InteropServices.COMException (Invalid pointer) error. See the full error text below.

This worked fine with Crystal XI but now breaks with Crystal 2008.

Is this a known problem and are there any workarounds?

Sample Code:

ReportDocument rptDoc = new ReportDocument();

rptDoc.Load("C:\somereport.rpt");

ExportOptions opts = new ExportOptions();

opts.ExportDestinationType = ExportDestinationType.DiskFile;

DiskFileDestinationOptions destOpts = ExportOptions.CreateDiskFileDestinationOptions();

destOpts.DiskFileName = "C:\outputfile.csv";

opts.ExportDestinationOptions = destOpts;

opts.ExportFormatType = ExportFormatType.CharacterSeparatedValues;

rptDoc.Export(opts);

Configuration:

Crystal Reports 2008 (Full Version)

C#

.NET 3.5

VS 2008

Exceptions:

System.Runtime.InteropServices.COMException occurred

Message="Invalid pointer\r"

Source="Analysis Server"

ErrorCode=-2147467259

StackTrace:

at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)

at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)

at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)

at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)

at CrystalDecisions.CrystalReports.Engine.ReportDocument.Export(ExportOptions options)

System.OutOfMemoryException occurred

Message="Exception of type 'System.OutOfMemoryException' was thrown."

Source="CrystalDecisions.ReportAppServer.Controllers"

StackTrace:

at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)

at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)

at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)

at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)

at CrystalDecisions.CrystalReports.Engine.ReportDocument.Export(ExportOptions options)

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi, Skip;

The first thing I need to know is if you have installed Service Pack 0 for Crystal Reports 2008. If not, you can download it here:

https://smpdl.sap-ag.de/~sapidp/012002523100007528552008E/cr2008_sp0.zip

Regards,

Jonathan

Answers (4)

Answers (4)

Former Member
0 Kudos

Have you got a solution for this? I encountered exceptions recently too, using Crystal Report Basic for Visual Studio 2008, exportToDisk to create a large reportdocument to rpt or pdf etc. Thanks advance for sharing!

former_member183750
Active Contributor
0 Kudos

Please create a new thread and see:

[Rules of Engagement|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement]

Step 2 Asking Your Question; Provide Enough Information

and

/people/ludek.uher/blog/2008/11/24/what-do-i-need-to-do-to-get-the-fastest-issue-resolution

- Ludek

Former Member
0 Kudos

Hi Yogesh

Any update on this?

Former Member
0 Kudos

Just to let you know, it is not just Skip getting this problem. I am getting both of the error messages Skip is. However I am running it as a web application. The machine is running 32bit Windows Server 2003 R2 with 4 gig of memory. If I export a large document to word (297 pages) format into a memory stream I get a system out of memory exception. If I try writing it to a file I get an invalid pointer exception. I am using the version Of CR that comes with Visual Studio 2008 although the report itself was created with CR10

former_member183750
Active Contributor
0 Kudos

I have just competed an export to csv from a table that had 2,000,000 records. Now, it is a simple dbf file with two fields. Both fields are on the report. This results in a report that has 25,710 pages

The export produces a csv file that has a size of 64,365 KB.

The report with saved data has a size of 23,305 KB.

An attempt to open the csv file in excel, results in the error:

"File not loaded completely"

In the information about the error, it states in part:

"The file contains more than 1,048,576 rows..."

And that makes sense as I'd expect 2,000,000 records / rows. Opening the csv file in notepad is successful.

So, the obvious question; What is the difference between your data and report and mine? Do you have SP 0 applied? Can you do the same export inthe CR designer?

Ludek

Former Member
0 Kudos

Jonathan,

I installed Service Pack 0 and am still getting the same errors. Unfortunately it did not fix the problem.

Thanks,

Skip

Former Member
0 Kudos

Hi Skip,

Just to test, can you try viewing the report and try to export using the Viewer Control? Does it work? How does it behave if exported to other formats? Is this issue in dev or production machine?

Would you like to try this method:

ReportDocumentObject.ExportToDisk(ExportFormatType.CharacterSeparatedValues,
"c:\\temp\\myRpt.csv");

Does this help?

Thanks.

Edited by: AG on Sep 13, 2008 3:08 AM

Edited by: AG on Sep 13, 2008 3:09 AM

former_member183750
Active Contributor
0 Kudos

Perhaps, the first place to start with these issues, is in the CR designer(?). Does it work there/ If not, it most certainly will not work at runtime...

Ludek

Former Member
0 Kudos

Iu2019ve tried testing several different scenarios, with mixed results:

Export from Report Designer, CSV Format - Success

C# - ReportDocument.Export(), CSV Format u2013 Failed

C# - ReportDocument.Export(), PDF Format u2013 Failed

C# - ReportDocument.ExportToDisk(), CSV Format u2013 Failed

Report Viewer u2013 Click Export Button, PDF Format u2013 Failed

The only thing that worked was exporting from the report designer.

Thanks,

Skip

former_member183750
Active Contributor
0 Kudos

1) Is this a large amount of data issue? (E.g.; can you export smaller data subset to CSV - say 100 or 1000 records?). If this starts to look like a number of records issue, can you determine the breaking point (plus / minus)?

2) Look in your temp directory. If you see temp report files there (which we do create), delete those and try the export again

3) Is it possible you are running out of HD space?

Ludek

Former Member
0 Kudos

This is definitely a size issue. I am able to export about 1.1 million rows successfully. When I export 1.3 million rows, it breaks. When I do a successful export with 1.1 million rows, the resulting CSV file size ends up being about 217mb.

I tried clearing out the temp files and still get the error message. When I run the 1.3 million export, it looks like 7 or 8 temp files get created. There are three large files ranging in size from 10mb to 392mb. They are named ~cpe{guid-like-number}.tmp.

I have tried this on multiple machines, with the same failure on each machine. But HD space is not a problem.

Thanks,

Skip

former_member183750
Active Contributor
0 Kudos

Skip, how much physical memory do you have on this computer? How much of this memory is used up on these exports?

Also, if this is a web app, look at the event log and see if they tell us something.

Ludek

Former Member
0 Kudos

I have 2.5GB RAM on my machine. I'm not running in a web environment; this is a WinForms app. It looks like the app is using about 112 MB while the export is running.

former_member183750
Active Contributor
0 Kudos

Skip, please see my last post re. results of my testing. I suppose the only question, of those I posed there, that applies to you, would be; what's the diff between your data and mine (as you've already supplied the other info in previous posts).

Ludek

Former Member
0 Kudos

Ludek,

The files that I am exporting to have 30 - 35 fields per line, depending on which template I use. Each line has between 180 - 220 characters total.

Skip

former_member183750
Active Contributor
0 Kudos

OK. I'll try to build a table with that many fields and see.

Ludek

Former Member
0 Kudos

Hello Skip and Ludek,

I have exact same problem with same exception. I am using Windows Form application.

Have you got the solution of it?

I Would like to appreciate any help.

Thanks.

former_member183750
Active Contributor
0 Kudos

I don't remember where this ended up...

But, what version of CR are you using?

What CR updates have you applied?

Are you getting the issue when exporting, or opening the file in Notepad, or Xls?

Are you able to determine a limit at which you do not get the error?

From the thread it appears that a number of records was not the issue, but perhaps the number of fields / characters per record was. Are you seeing your issue with number of records or number of fields. E.g.; if you can define the limiting parameters, that would be great.

Also, are you able to do the export successfully from the CR designer?

Ludek

Former Member
0 Kudos

Hello Ludek, Thanks for the reply.

I am using 'Crystal Report Basic For Visual Studio 2008 - version 10.5' version of the Crystal Report.

I have 12 columns in my Report. Out of these 12 columns 2 columns display images (one is of size 320X240 and second one is of size 120X240).

Some description is as :-

When Report contain 1180 events, and when I export it as .xls( Size - 21, 492 KB i.e near about 22.5 MB) and .pdf ( Size :- 153,961 KB i.e near about 154MB) it get export properly without an error.

When Report contan 1451 events, and when I export it as .xls (size :- 26,644 KB i.e. Near about 26.6MB) it export properly without an error. But if I try to export it as .pdf it gives " Invalid Pointer" exception.

When Report contain 2813 events and when I export it as .xls (size :- 13, 957 KB) it get export properly without an error but this xls file does not contain the images. (If you look into size of xls for 1451 Events Report and 2813 Events Report, xls for 2813 Events Report has lower size than 1451 Events Reports, because it does not contain the images.) If I export this Report as .pdf , it gives "Invalid Pointer" exception.

I used my own code to export the report in various formats.

What should be done to export the large sized Reports in all possible formats?

Thanks in advance.

Edited by: YogeshP on Sep 2, 2009 2:20 PM

former_member183750
Active Contributor
0 Kudos

I am not sure. Let me dig a bit around here for some details. Meanwhile, I want you to download SP 1 for CR 10.5 from here:

https://smpdl.sap-ag.de/~sapidp/012002523100009351512008E/crbasic2008sp1.exe

Let me know if the SP helped.

Ludek

Former Member
0 Kudos

Hello Ludek,

Thank you for the link and reply. But my client is using 'Crystal Report Basic For Visual Studio 2008 - Version 10.5' version (which come with Visual Studio 2008). It may possible that they will not switch to SP1 for CR 10.5. So I would like to know if it is possible in the current installed version of CR or not. Meanwhile I will try with SP1 for CR 10.5.

I would like to appreciate your help. Thanks in advance.

former_member183750
Active Contributor
0 Kudos

It should be possible. But without SP 1, it does not make much sense to keep going. If the issue can be duplicated with SP 1, we can then proceed to trying to duplicate it here and escalating for a fix or trying with a newer version of CR.

Ludek

Former Member
0 Kudos

Thanks Ludek for your help.

If it works with 'Crystal Report 2008 SP1' it would be nice, but unfortunately if it doesn't, then I suppose to move with default 'Crystal Report Basic For Visual Studio 2008 - 10.5 Version'. So, can you please tell me from where I can download this

'Crystal Report Basic For Visual Studio 2008 - 10.5 Version' (which comes with Visual Studio)?

Thanks in advance.

Former Member
0 Kudos

Hi Ludek,

I uninstalled 'Crystal Report Basic For Visual Studio 2008 (10.5 version)' and installed 'Crystal Report Basic For Visual Studio 2008 Service Pack 1'. But after installation, my Registry does not contain 'CR Ent' node and its value under 'Business Objects -> 10.5 -> Crystal Reports -> Keycodes'. Also, registry does not contain 'Crystal Decisions' tag and its all sub-nodes.

Also, my .rpt files created with previous version does not has logo of Crystal Report. Even I can't create new Crystal Report from VS2008 workspace. When I run my application which has CR created with previous version , it says CrystalDecision dlls are missing. When I check them, these dlls are present in the Program Files folder.

Whats wrong am I doing? How can I work with this new SP1 version?

Thanks in advance.

former_member183750
Active Contributor
0 Kudos

Unistall SP1. Do a .NEt 2008 repair and reinstall Crystal Report Basic For Visual Studio 2008. Then apply SP 1 on top of that install.

Ludek

Former Member
0 Kudos

Thank you very much Ludek.

I will get back to you after a try.

Thank you.

Former Member
0 Kudos

Hi Ludek,

I am also getting same exception.Do we have any work around for this?

Regards

Madhavi Goud.

former_member183750
Active Contributor
0 Kudos

Well, since I did not receive a reply since September, I assume the issue was resolved then. I'd like to suggest you create a new thread, provide as much info as possible and let's tackle it from htere.

Ludek

Follow us on Twitter http://twitter.com/SAPCRNetSup