Hi, I'm testing out your tesseract project in my website. Currently, I have it set up to spin up a new TessBaseAPI instance on startup of the webapp, using 4 languages - English, French, German, and Russian. Then, when http requests come my way, I simply use the single instance for all requests, to eliminate the amount of time it takes to instantiate a new TessBaseAPI object. In my development testing, this was working fine. However, after exposing it to a production load with lots of simultaneous requests, it crashed the Java process. Also, this log file was created in the home directory of my .jar file:
hs_err_pid30745.log
I can provide the contents of this log file if it will help determine what went wrong.
My question is this: Am I misusing tesseract? Should I always spin up and destroy a TessBaseAPI instance for each request, even though it will increase response times for my users?
Thanks!
Duplicate of issue #64.
Tesseract context objects are not thread-safe. Try to use one instance of TessBaseAPI per thread.
Thanks, I'll rearrange to accommodate for that.
So far, so good. However, I'm seeing some persistent memory with each usage of the TessBaseAPI... upon further inspection, it looks like StringGenericVector has a few methods that I'm not currently calling: clear(), close(), empty(), deallocate(), etc.
Should I be calling any or all of these when I am done with a StringGenericVector object? ("done" = I have passed them into the Init() method of the TessBaseAPI object and no longer need them)
GC will eventually get to them, but yeah calling close() or deallocate() is
a good idea.