Chris
Chris

Reputation: 31266

How does one clear the tesseract cache?

I am using the cffi library with tesseract's C-interface.

My deletion pattern is:

if self.result_iterator != self.ffi.NULL and self.result_iterator is not None:
    self.TessResultIteratorDelete(self.result_iterator)

self.TessBaseAPIClearPersistentCache(self.agent)
self.TessBaseAPIClear(self.agent)
self.TessBaseAPIEnd(self.agent)
self.TessBaseAPIDelete(self.agent)
self.agent = None

I have thrown every delete method I can think of or find in the library at this.

However, my memory usage graph monotonically increases until OOM-killed when processing the same image over and over.

This happens whether or not I call the deletion method above.

Memory Usage Pattern -- each bump is another recognition event


My interpretation here is that libtesseract has some mystery cache that it keeps around to prevent re-processing. The mystery cache is either not getting freed or not getting garbage collected.

Is there a way to release this cache that I am missing?

Upvotes: 1

Views: 434

Answers (0)

Related Questions