G
Guest
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.
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.