473,394 Members | 1,932 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Windows Application Build Mode?

WB
Hi,

I have a C# Windows application that reads a bunch of PDF files and append
them together. Basically it does it by reading a first 2 PDF files, append
them and save the result as a PDF file. Then append the 3rd PDF to this
result and save. Then the 4th one and save and so on... In total it can be
appending up to 50 PDF files, each with file size ranges between 10 to over
50MB.

It runs fine when it's built in Debug mode. But when it's built in Release
mode, it will not be able to handle appending of large number of big size
files. It gives the following error in the line when it tries to save.

System.AccessViolationException: Attempted to read or write protected
memory. This is often an indication that other memory is corrupt.

And it doesn't fail at a consistent point. Sometimes it fails on the 10th
file, sometimes after 35 files, even when tested against the same set of
files. However, when tested on a smaller set of small size PDF files, it
won't give a problem.

At first I thought it's something wrong with my multi-threading, so now I
just run everything in a single thread but it's still the same.

I don't intend to put my codes here 'cuz it's too long and there are many
classes etc. Instead, I'd just like to ask a general question -- what's the
difference between a program compiled in Release and Debug mode that can
contribute to this error?

My understanding is that building in Release mode optimizes the performance
and disables all Debug class methods but I don't see how these are related to
my problem.

Thanks,
WB.
Apr 26 '06 #1
2 2760
WB
Hi,

We use a 3rd party software call ABCpdf to handle that. Basically the code
is something like this:

Doc theDoc1 = new Doc();
theDoc1.Read("C:\\file1.pdf");
Doc theDoc2 = new Doc();
theDoc2.Read("C:\\file2.pdf");
theDoc1.Append(theDoc2);
theDoc1.Save("C:\\output.pdf");
theDoc1.Dispose();
theDoc2.Dispose();

Doc() is a class from the software...

What's P/Invoke?
WB.

"Vadym Stetsyak" wrote:
Hello, WB!

W> It runs fine when it's built in Debug mode. But when it's built in
W> Release mode, it will not be able to handle appending of large number of
W> big size files. It gives the following error in the line when it tries
W> to save.

W> System.AccessViolationException: Attempted to read or write protected
W> memory. This is often an indication that other memory is corrupt.

W> And it doesn't fail at a consistent point. Sometimes it fails on the
W> 10th file, sometimes after 35 files, even when tested against the same
W> set of files. However, when tested on a smaller set of small size PDF
W> files, it won't give a problem.

How do you handle PDF merge? I suppose you use some P/Invoke?
Take a look at
( http://dotnetdebug.blogspot.com/2006...ed-issues.html )

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot

Apr 27 '06 #2
Hello, WB!

W> We use a 3rd party software call ABCpdf to handle that. Basically the
W> code is something like this:

W> Doc theDoc1 = new Doc();
W> theDoc1.Read("C:\\file1.pdf");
W> Doc theDoc2 = new Doc();
W> theDoc2.Read("C:\\file2.pdf");
W> theDoc1.Append(theDoc2);
W> theDoc1.Save("C:\\output.pdf");
W> theDoc1.Dispose();
W> theDoc2.Dispose();

W> Doc() is a class from the software...

It looks like on the bug in that software...

W> What's P/Invoke?

It is called Platform Invoke and it is used to call unmanaged functions.

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Apr 28 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: paul calvert | last post by:
I hope somewhere here has encountered and solved a similar problem in the past. 1) on a new Win2000 PC: installed Visual C++ 6.0 download & install single file Service Pack 5.0 2) try to...
1
by: Fred Iannon | last post by:
All, I have developed an application that needs to run in one of two modes: (1) IF NO command line parms are provided I would like it to run as a Window form application (i.e. /target:winexe)...
3
by: Brad Burke | last post by:
From a windows .Net app, I need to 1) check if MSAccess is already open to a certain Access application. If so, then open a form and find a certain record. 2) If not open, then open MSAccess and...
2
by: Fadi | last post by:
Backround: I am trying to figure out how to do the equivalant of a classic COM Local Server Singleton in .NET/C#. I created a coupld of simple Class Libs that exposes public interfaces and hosted...
3
by: Jeremy S. | last post by:
On my dev machine (XP/Pro with VS.NET 2003) I have been developing a Windows Service and installing it on the local machine by opening the Visual Studio Command Prompt and then executing . Now I...
4
by: Bruce | last post by:
I thought that I had read somewhere before about a limit to the number of DLL's that could be loaded by a 32 bit application when it is run on Windows 98/ME operating systems. But I can't seem...
0
by: emu | last post by:
Hi All, I have an unmanaged C++ application that references a mixed mode image DLL (mixed managed and unmanaged). Under .NET 1.1 we could trust the dll (the mixed mode dll) by running the...
5
by: JM | last post by:
I have created a Windows Service which uses xml file as a data source. The service is running on .NET 2.0 and uses LocalSystem account. It was running fine but now it has started locking the xml...
1
by: inungh | last post by:
I tried to place a grid view on my design view and connect to new data source to local SQL Express server Northwind database. I got error message on line 80 <authentication mode="Windows"/> ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.