I have uncommented lines:

pTess->Clear();

pTess->End();


and I noticed a little improvement, but the RAM eaten by app is still high 
… when you wrote "END()" you meant pTess->End() ?





On Thursday, June 20, 2019 at 2:42:49 PM UTC+3, zdenop wrote:

> IMO you have to call END() to correctly close tesseract instance.
>
> Zdenko
>
>
> št 20. 6. 2019 o 13:02 _ Flaviu <[email protected] <javascript:>> 
> napísal(a):
>
>> I am using tesseract 4 on a VC++ (MFC) app, to read text from images (A4 
>> sizes). I noticed that while I using this app on several PCs (Win10 64 bit, 
>> *GB RAM), the RAM occupied by my app (that use tesseract) is increasing on 
>> and on. If I read 14 images, my app eat 470 MB, and if I didn't close the 
>> app and read again all these 14 images, the RAM eaten by my app is 
>> increasing until ~800MB, and if continue to read the same images, the RAM 
>> is increasing on an on. Why is this happen ?
>>
>> Here is the code that I am using for tesseract:
>>
>> BOOL CMyClass::GetTextFromImage()
>> {
>> PIX* pix = NULL;
>> tesseract::TessBaseAPI* pTess = new tesseract::TessBaseAPI;
>>
>> do
>> {
>> if (pTess->Init(...))
>> {
>> m_sError.Format(_T("OCRTesseract: Could not initialize tesseract."));
>> break;
>> }
>> // setup
>> // read image
>> PIX* pix = pixRead(m_sFileName);
>> if (! pix)
>> {
>> break;
>> }
>> // recognize
>> pTess->SetImage(pix);
>> }
>> while (FALSE);
>>
>> // cleanup
>> // pTess->Clear();
>> // pTess->End();
>> delete pTess;
>> pTess = NULL;
>> pixDestroy(&pix);
>>
>> return TRUE;
>> }
>>
>>
>> Is there anything wrong here ? Why is increasing RAM while I am using 
>> tesseract ?
>>
>> -- 
>> 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 [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/tesseract-ocr.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/tesseract-ocr/8be010ab-c948-47d3-b51e-ac141ce12bbd%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/tesseract-ocr/8be010ab-c948-47d3-b51e-ac141ce12bbd%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tesseract-ocr/96d9ff52-e7d0-45e9-87f8-05d51ec61142%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to