Memory leak

178 views
Skip to first unread message

Jesse

unread,
Jan 14, 2009, 1:26:42 PM1/14/09
to tesseract-ocr
I have been searching for awhile for a semi decent OCR software that
has a .NET interface and was very happy to find tesseract (as well as
tessnet2) however I have implemented it and I have noticed an drastic
increased in memory usage after I read about 100 or so images. I have
been searching throughout the discussions and found that I was not
alone. I was wondering if anyone could tell me whether or not this is
tessnet2 error or if this is a tesseract error. And of course a way to
fix it, if possible.

I was originally using MODI (M$ Office Document Imaging) to do my OCR
but the text reading was terrible and it just randomly crashed at odd
intervals causing the file it was reading at the time to lock up and
thus my program could not overwrite the file for the next pass.

rthomas

unread,
Jan 15, 2009, 3:21:49 AM1/15/09
to tesseract-ocr
Yes,

There is memory leak in tesseract and also some problems to reset the
"state engine", this mean when you give the same file twice you don't
get the same results.
The only workaround is to use it in command line, this mean you create
a new process for each document, Windows do the cleanup for you when
the process exit.

Rémi

SteveP

unread,
Jan 15, 2009, 11:51:21 AM1/15/09
to tesseract-ocr
Very good to know about the memory leaks and state engine issues.
Have you heard anything about whether or not there are plans to fix
these issues and if so, when?
> > thus my program could not overwrite the file for the next pass.- Hide quoted text -
>
> - Show quoted text -

Ray Smith

unread,
Jan 15, 2009, 12:03:27 PM1/15/09
to tesser...@googlegroups.com
Can you test against the latest code in svn? I think the memory leaks are fixed in there, but I am not sure. (Confused as to what was fixed when.)
Let me know what you find, so I can try to incorporate more fixes from 3.00 if necessary.
Ray.

Jesse

unread,
Jan 15, 2009, 5:05:13 PM1/15/09
to tesseract-ocr
I downloaded the latest code changes and compiled it with tessnet2 and
the memory leak still appears to be there. If someone gets a different
result please post the tessnet2.dll.

On Jan 15, 11:03 am, "Ray Smith" <theraysm...@gmail.com> wrote:
> Can you test against the latest code in svn? I think the memory leaks are
> fixed in there, but I am not sure. (Confused as to what was fixed when.)Let
> me know what you find, so I can try to incorporate more fixes from 3.00 if
> necessary.
> Ray.
>

rthomas

unread,
Jan 16, 2009, 7:55:24 AM1/16/09
to tesseract-ocr
Still have the leak

Remi

Anshul Maheshwari

unread,
Aug 13, 2015, 6:00:46 AM8/13/15
to tesseract-ocr
I have pasted valgrind output, where tesseract is just linked not used any single api of tessearct in my code.
then it have following allocation and no free

==5923== 64 bytes in 1 blocks are still reachable in loss record 1 of 5
==5923==    at 0x4C29D90: operator new[](unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==5923==    by 0x4FF9AD1: GenericVector<tesseract::StringParam*>::reserve(int) [clone .part.3] (in /usr/local/lib64/libtesseract.so.3.0.4)
==5923==    by 0x4EE4132: _GLOBAL__sub_I_drawfx.cpp (in /usr/local/lib64/libtesseract.so.3.0.4)
==5923==    by 0x400E929: call_init.part.0 (in /lib64/ld-2.19.so)
==5923==    by 0x400EA12: _dl_init (in /lib64/ld-2.19.so)
==5923==    by 0x40011C9: ??? (in /lib64/ld-2.19.so)
==5923==
==5923== 128 bytes in 1 blocks are still reachable in loss record 2 of 5
==5923==    at 0x4C29670: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==5923==    by 0x509BDE9: GlobalParams() (in /usr/local/lib64/libtesseract.so.3.0.4)
==5923==    by 0x4EDCDBF: _GLOBAL__sub_I_baseapi.cpp (in /usr/local/lib64/libtesseract.so.3.0.4)
==5923==    by 0x400E929: call_init.part.0 (in /lib64/ld-2.19.so)
==5923==    by 0x400EA12: _dl_init (in /lib64/ld-2.19.so)
==5923==    by 0x40011C9: ??? (in /lib64/ld-2.19.so)
==5923==
==5923== 512 bytes in 1 blocks are still reachable in loss record 3 of 5
==5923==    at 0x4C29D90: operator new[](unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==5923==    by 0x4F29231: GenericVector<tesseract::IntParam*>::reserve(int) [clone .part.47] (in /usr/local/lib64/libtesseract.so.3.0.4)
==5923==    by 0x4F2B887: GenericVector<tesseract::IntParam*>::push_back(tesseract::IntParam*) (in /usr/local/lib64/libtesseract.so.3.0.4)
==5923==    by 0x4EE0BC6: _GLOBAL__sub_I_makerow.cpp (in /usr/local/lib64/libtesseract.so.3.0.4)
==5923==    by 0x400E929: call_init.part.0 (in /lib64/ld-2.19.so)
==5923==    by 0x400EA12: _dl_init (in /lib64/ld-2.19.so)
==5923==    by 0x40011C9: ??? (in /lib64/ld-2.19.so)
==5923==
==5923== 1,024 bytes in 1 blocks are still reachable in loss record 4 of 5
==5923==    at 0x4C29D90: operator new[](unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==5923==    by 0x4F085F1: GenericVector<tesseract::BoolParam*>::reserve(int) [clone .part.74] (in /usr/local/lib64/libtesseract.so.3.0.4)
==5923==    by 0x4F0EDB7: GenericVector<tesseract::BoolParam*>::push_back(tesseract::BoolParam*) (in /usr/local/lib64/libtesseract.so.3.0.4)
==5923==    by 0x4EE2AA5: _GLOBAL__sub_I_topitch.cpp (in /usr/local/lib64/libtesseract.so.3.0.4)
==5923==    by 0x400E929: call_init.part.0 (in /lib64/ld-2.19.so)
==5923==    by 0x400EA12: _dl_init (in /lib64/ld-2.19.so)
==5923==    by 0x40011C9: ??? (in /lib64/ld-2.19.so)
==5923==
==5923== 1,024 bytes in 1 blocks are still reachable in loss record 5 of 5
==5923==    at 0x4C29D90: operator new[](unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==5923==    by 0x4F373B1: GenericVector<tesseract::DoubleParam*>::reserve(int) [clone .part.40] (in /usr/local/lib64/libtesseract.so.3.0.4)
==5923==    by 0x4F42B97: GenericVector<tesseract::DoubleParam*>::push_back(tesseract::DoubleParam*) (in /usr/local/lib64/libtesseract.so.3.0.4)
==5923==    by 0x4EE5176: _GLOBAL__sub_I_intproto.cpp (in /usr/local/lib64/libtesseract.so.3.0.4)
==5923==    by 0x400E929: call_init.part.0 (in /lib64/ld-2.19.so)
==5923==    by 0x400EA12: _dl_init (in /lib64/ld-2.19.so)
==5923==    by 0x40011C9: ??? (in /lib64/ld-2.19.so)

Thanks
Anshul

ShreeDevi Kumar

unread,
Aug 14, 2015, 2:26:46 AM8/14/15
to tesser...@googlegroups.com

It maybe best to post this as an issue

- sent from my phone. excuse the brevity and typos.

--
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 post to this group, send email to tesser...@googlegroups.com.
Visit this group at http://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/dfa263ae-5abd-4eb3-b528-cef9c541dc6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages