"attempted to read or write protected memory" error--a puzzler

172 views
Skip to first unread message

Robert K S

unread,
Jul 9, 2008, 1:25:03 AM7/9/08
to tesseract-ocr
I'm getting a strange error in a program that uses Tesseract.

The application is a video player with OCR built in. Click a button
on the player's controls toolbar to trigger OCR of the on-screen text.

Sometimes, I get an error:

Error processing image: System.AccessViolationException(): Attempted
to read or write protected memory. This is often an indication that
other memory is corrupt.
at Application.Tesseract.TessDllRecognize_all_Words()
at Application.Tesseract.Recognize(Bitmap image, Int32 startX, Int32
startY, Int32 endX, Int32 endY)
at Application.MainForm.OCR()

Here's the interesting thing. I've only ever gotten the error when
working with files above a certain resolution--a 320 x 240 video file,
for example, will never spark the error message--and it only ever
happens when a line of text ends with a hyphen, as when a long word
(or a hyphenated word) is broken up onto two separate lines.

Once the error occurs, successive triggers of the OCR only pop up the
same error message. I have to close the application and open it back
up again to restore functionality.

The problem seems to be in Tesseract. Does anybody have any clue what
could be causing the error and how to resolve the issue?

Thanks in advance,
Robert

rthomas

unread,
Jul 9, 2008, 2:00:15 AM7/9/08
to tesseract-ocr
Hi,

The faster way to find this bug is to recompile tessnet2.dll and
execute the program in Visual Studio 2008.

Remi

marecko

unread,
Jul 25, 2008, 9:45:03 AM7/25/08
to tesseract-ocr
I getting same error.
I am running Tesseract from within IIS. It can call tesseract with
quite high frequency about 10 times a second.
Before, I used to start new process with Tesseract.exe for every image
recognision.
I have not encountered any problems then.

Recently I have changed it to use [DllImport("tessdll.dll")] and after
a while (40-100 calls) I am getting "attempted to read or write
protected memory" error
I have to restart IIS aspnet_wp process to get it working again.

When it crashes it does not even try to create log file and I can not
attach to tessdll.dll when it runs within IIS.

Any ideas?

Thanks,
Marek
> > Robert- Hide quoted text -
>
> - Show quoted text -

nguyenq

unread,
Jul 25, 2008, 10:44:31 AM7/25/08
to tesseract-ocr
I, too, frequently get the same error, after running a few OCR
iterations. The program VietOCR.NET uses tessnet2.dll, which wraps
tessdll.dll.

marecko

unread,
Aug 13, 2008, 12:16:10 PM8/13/08
to tesseract-ocr
Sorry my bad.

It is all good. I had another client hitting my server at the same
time.
and tessDll is not thread safe of course.
> > - Show quoted text -- Hide quoted text -
Reply all
Reply to author
Forward
0 new messages