By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,167 Members | 1,692 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,167 IT Pros & Developers. It's quick & easy.

System.OutOfMemoryException while Creating PDF files

P: n/a
Hi,

I am using C# with framework 2.0 and creating PDF files on-fly, along
with this I am using Windows 2003 Server.

I am using Byte[] to take the data input and then save into pdf format
on harddrive location.

Now after creating few successful pdf files, I am getting
"System.OutOfMemoryException".

Is this problem coming because of large data is been sent to Byte[] to
create PDF file or something else could be the cause.

If so, then how to resolve this issue??

Thanks in Advance,

Manoj

Oct 23 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi Aryan,

It might be that you aren't releasing the memory.
I suggest you to take a look at your application with a memory profiler.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"Aryan" <ma*********@gmail.comwrote in message
news:11**********************@e34g2000pro.googlegr oups.com...
Hi,

I am using C# with framework 2.0 and creating PDF files on-fly, along
with this I am using Windows 2003 Server.

I am using Byte[] to take the data input and then save into pdf format
on harddrive location.

Now after creating few successful pdf files, I am getting
"System.OutOfMemoryException".

Is this problem coming because of large data is been sent to Byte[] to
create PDF file or something else could be the cause.

If so, then how to resolve this issue??

Thanks in Advance,

Manoj
Oct 23 '07 #2

P: n/a
Hi,
--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"Aryan" <ma*********@gmail.comwrote in message
news:11**********************@e34g2000pro.googlegr oups.com...
Hi,

I am using C# with framework 2.0 and creating PDF files on-fly, along
with this I am using Windows 2003 Server.
What are you using to create the PDF? iTextSharp?
I am using Byte[] to take the data input and then save into pdf format
on harddrive location.
How big your PDFs are?
Now after creating few successful pdf files, I am getting
"System.OutOfMemoryException".
What if you use a file instead?

If this do not solve your question, post some code.
Oct 23 '07 #3

P: n/a
see cross-post to dotnet.general it is a 3000-5000 page report
generated in a single buffer via ReportExecutionService.

I can't think of anything I could possibly do here other than take it
back to first principles... my first question would be "why....?"

Marc
Oct 23 '07 #4

P: n/a
Hi,
--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"Marc Gravell" <ma**********@gmail.comwrote in message
news:ep**************@TK2MSFTNGP06.phx.gbl...
see cross-post to dotnet.general it is a 3000-5000 page report generated
in a single buffer via ReportExecutionService.

I can't think of anything I could possibly do here other than take it back
to first principles... my first question would be "why....?"

Apparentely Render cannot use a Stream. It needs all the file in memoky,
hikes!
Oct 23 '07 #5

P: n/a
Manoj,

This sounds like a problem with something (probably the byte[]) not
being freed. Make sure your variables are going out of scope.

A couple of other ideas/possibilities.
1) GC is slow to to cleanup. (Very unlikely but might be possible.)
2) I believe System.Diagnostics namespace or GC has a way to check
current memory allocation. Stop the code after a couple of pdf files are
created and check memory allocation. If the allocation does not drop,
then you've got variables not being freed.
3) Check to file handle used to create the file. If not flushed and
closed, this could easily cause excess memory usage.

Hope this helps,
Oscar
Aryan wrote:
Hi,

I am using C# with framework 2.0 and creating PDF files on-fly, along
with this I am using Windows 2003 Server.

I am using Byte[] to take the data input and then save into pdf format
on harddrive location.

Now after creating few successful pdf files, I am getting
"System.OutOfMemoryException".

Is this problem coming because of large data is been sent to Byte[] to
create PDF file or something else could be the cause.

If so, then how to resolve this issue??

Thanks in Advance,

Manoj
Nov 15 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.