Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / December 2007

Tip: Looking for answers? Try searching our database.

Cleaning up large amounts of data

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
volt9000@gmail.com - 02 Dec 2007 19:21 GMT
I'm using PdfSharp (an open-source PDF manipulation library) to
generate a very large PDF ( 1500+ pages.) My program crashes before
reaching the end because of the massive amounts of memory being used
(after 750 entries the memory footprint is ONE GIGABYTE.)

So I've gotten around this by splitting up the word: every X number of
entries, I close the PDF and start a new one, with the intention of
combining the PDFs at the end. The problem is, after all is said and
done, the memory footprint of the program is still quite large (nearly
200MB) despite my attempts to release the object. I've tried several
methods including trying to force the garbage collector (GC.Collect()
and GC.WaitForPendingFinalizers()) but nothing seems to help.

How can I release the memory?
Serge Baltic - 02 Dec 2007 21:31 GMT
Hello,

> The problem is, after all is said and
> done, the memory footprint of the program is still quite large (nearly
> 200MB) despite my attempts to release the object.

What exactly kind of memory is that? Virtual, commit charge, managed memory?
The metric to check is GC.GetTotalMemory(true) (assuming that the free pdf
component is all managed code). If the managed memory is low, but the commit
charge is high, that's OK and not necessary a leak. That will be reused by
.NET.

If the managed memory is high, you could take some Memory Profiling tool
(I'd use dotTrace) and check the objects that are not being collected. If
they're being held by the pdf component, there's not much that can be done
without editing its code, I'm afraid …

PS. BTW, there's the XPS format that basically counters the PDF functionality,
but is powered by Microsoft and highly integrates with .NET, like, there
are framework classes for generating those documents. Maybe that could serve
as a working alternative for you.

(H) Serge

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.