WARNING! LEAK!

73 views
Skip to first unread message

Björn Gitter

unread,
Oct 27, 2022, 5:17:05 AM10/27/22
to tesseract-ocr
I'm using Tesseract 4.1.1 and Tesseract.Drawing 4.1.1 in c#
I downloaded the language data from https://github.com/tesseract-ocr/tessdata_fast

The app works and extracts the correct data but I get the following error messages:
ObjectCache(00007FF81981DEC8)::~ObjectCache(): WARNING! LEAK! object 000001D5B1B72440 still has count 1 (id f:\tessdata/eng.traineddatalstm-punc-dawg)
ObjectCache(00007FF81981DEC8)::~ObjectCache(): WARNING! LEAK! object 000001D5B1B71AE0 still has count 1 (id f:\tessdata/eng.traineddatalstm-word-dawg)
ObjectCache(00007FF81981DEC8)::~ObjectCache(): WARNING! LEAK! object 000001D5B1B716C0 still has count 1 (id f:\tessdata/eng.traineddatalstm-number-dawg)


Any suggestions on how to not get the leak?

TesseractEngine engine = new TesseractEngine("f:\\tessdata", "eng", EngineMode.LstmOnly);
engine.SetVariable("tessedit_char_whitelist", "0123456789:/");

Bitmap tmpbitmap = capturearea(119, 1651, 200, 35);
Pix bmpinpix = PixConverter.ToPix(tmpbitmap);

using (var page = engine.Process(bmpinpix, PageSegMode.Auto))
{
    var text = page.GetText();
    Console.WriteLine(text);
    }



Zdenko Podobny

unread,
Oct 27, 2022, 5:35:48 AM10/27/22
to tesser...@googlegroups.com
I am not sure about C#, but the rules for c++ are described e.h. here:


št 27. 10. 2022 o 11:17 Björn Gitter <blitz...@gmail.com> napísal(a):
--
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-oc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/cd582594-a287-4f15-af67-6be9dd8f26bfn%40googlegroups.com.

Björn Gitter

unread,
Oct 27, 2022, 7:03:53 AM10/27/22
to tesseract-ocr
I'm a noob - forgot to dispose of engine. 

Adding engine.Dispose(); fixes the problem.

Reply all
Reply to author
Forward
0 new messages