rewards110
rewards110

Reputation: 3

How to fix exception Invalid memory access failed loading language in tess4j

I have a code where I read image text using Tesseract in java 8.

I even changed the Datapath to point within the source folder on eclipse but still getting this exception within that period of running the program.

How do I fix this problem? Should I dispose the BufferedImage if possible how to do that?

Upvotes: 0

Views: 145

Answers (1)

nguyenq
nguyenq

Reputation: 8365

setDatapath should not be in the loop; it needs be called only once after the Tesseract instance is created. I would dispose of the instance and start a new one after so many OCR operations; otherwise, the memory leaks in the native code will eventually crash the JVM.

Upvotes: 0

Related Questions