|
From: João M. S. S. <joa...@gm...> - 2014-12-08 19:09:17
|
Hi, Can I provide valgrind with source files so that source code lines of libraries compiled without -g are still shown? For example, I get this memory leak warning: ==19995== 24 bytes in 1 blocks are possibly lost in loss record 110 of 354 ==19995== at 0x4C2ABBD: malloc (vg_replace_malloc.c:299) ==19995== by 0x5D7C4F3: STRING::AllocData(int, int) (in /usr/lib/libtesseract.so.3.0.3) ==19995== by 0x5D7C5E2: STRING::STRING() (in /usr/lib/libtesseract.so.3.0.3) ==19995== by 0x5D2E597: tesseract::DawgLoader::Load() (in /usr/lib/libtesseract.so.3.0.3) ==19995== by 0x5D2E972: _TessMemberResultCallback_0_0<true, tesseract::Dawg*, tesseract::DawgLoader>::Run() (in /usr/lib/libtesseract.so.3.0.3) ==19995== by 0x5D2E848: tesseract::DawgCache::GetSquishedDawg(STRING const&, char const*, tesseract::TessdataType, int) (in /usr/lib/libtesseract.so.3.0.3) ==19995== by 0x5D3623F: tesseract::Dict::Load(tesseract::DawgCache*) (in /usr/lib/libtesseract.so.3.0.3) ==19995== by 0x5CF910F: tesseract::Wordrec::program_editup(char const*, bool, bool) (in /usr/lib/libtesseract.so.3.0.3) ==19995== by 0x5C28C28: tesseract::Tesseract::init_tesseract_internal(char const*, char const*, char const*, tesseract::OcrEngineMode, char**, int, GenericVector<STRING> const*, GenericVector<STRING> const*, bool) (in /usr/lib/libtesseract.so.3.0.3) ==19995== by 0x5C2949E: tesseract::Tesseract::init_tesseract(char const*, char const*, char const*, tesseract::OcrEngineMode, char**, int, GenericVector<STRING> const*, GenericVector<STRING> const*, bool) (in /usr/lib/libtesseract.so.3.0.3) ==19995== by 0x5BDD4BB: tesseract::TessBaseAPI::Init(char const*, char const*, tesseract::OcrEngineMode, char**, int, GenericVector<STRING> const*, GenericVector<STRING> const*, bool) (in /usr/lib/libtesseract.so.3.0.3) ==19995== by 0x420E07: Tesseract::Tesseract() (Tesseract.cpp:13) but I can't tell exactly where it comes from. If I was able to tell valgrind that the source code for tesseract is somewhere, it would avoid having to recompile all my code against tesseract sources? Thanks. -- João M. S. Silva |
|
From: Tom H. <to...@co...> - 2014-12-08 19:24:51
|
On 08/12/14 19:09, "João M. S. Silva" wrote: > Can I provide valgrind with source files so that source code lines of > libraries compiled without -g are still shown? > > For example, I get this memory leak warning: [ snipped ] > but I can't tell exactly where it comes from. > > If I was able to tell valgrind that the source code for tesseract is > somewhere, it would avoid having to recompile all my code against > tesseract sources? How would that work? Valgrind would still need the debug information in order to know which addresses in your compiled code map to each line in the source files... Tom -- Tom Hughes (to...@co...) http://compton.nu/ |
|
From: João M. S. S. <joa...@gm...> - 2014-12-08 19:29:03
|
Thanks Tom, I was not sure that was feasible. What is the easiest/standard way in which I can get the source code line of the possible leak? Is it compiling my code against tesseract's source code? Or should I compile tesseract in debug mode and then use that library? Thanks. On 12/08/2014 07:24 PM, Tom Hughes wrote: > On 08/12/14 19:09, "João M. S. Silva" wrote: > >> Can I provide valgrind with source files so that source code lines of >> libraries compiled without -g are still shown? >> >> For example, I get this memory leak warning: > > [ snipped ] > >> but I can't tell exactly where it comes from. >> >> If I was able to tell valgrind that the source code for tesseract is >> somewhere, it would avoid having to recompile all my code against >> tesseract sources? > > How would that work? Valgrind would still need the debug information in > order to know which addresses in your compiled code map to each line in > the source files... > > Tom > -- João M. S. Silva |
|
From: Tom H. <to...@co...> - 2014-12-08 19:31:29
|
On 08/12/14 19:28, "João M. S. Silva" wrote: > Thanks Tom, I was not sure that was feasible. > > What is the easiest/standard way in which I can get the source code line > of the possible leak? Is it compiling my code against tesseract's source > code? > > Or should I compile tesseract in debug mode and then use that library? Well I don't know what here is "your" code and what isn't, but broadly speaking for your own code just make sure to compile with debug and for code from the distro make sure to install the debuginfo packages. Tom -- Tom Hughes (to...@co...) http://compton.nu/ |
|
From: João M. S. S. <joa...@gm...> - 2014-12-08 20:12:13
|
I'm using Ubuntu and I can't seem to find an exact equivalent of Fedora's debuginfo, except -dbg packages. However, tesseract does not have a -dbg package. My code uses tesseract library, i.e. libtesseract-dev. Since a libtesseract-dbg package is not available, I probably have to compile it myself. On 12/08/2014 07:31 PM, Tom Hughes wrote: > On 08/12/14 19:28, "João M. S. Silva" wrote: > >> Thanks Tom, I was not sure that was feasible. >> >> What is the easiest/standard way in which I can get the source code line >> of the possible leak? Is it compiling my code against tesseract's source >> code? >> >> Or should I compile tesseract in debug mode and then use that library? > > Well I don't know what here is "your" code and what isn't, but broadly > speaking for your own code just make sure to compile with debug and for > code from the distro make sure to install the debuginfo packages. > > Tom > -- João M. S. Silva |
|
From: Tom H. <to...@co...> - 2014-12-08 20:19:12
|
On 08/12/14 20:12, "João M. S. Silva" wrote: > I'm using Ubuntu and I can't seem to find an exact equivalent of > Fedora's debuginfo, except -dbg packages. However, tesseract does not > have a -dbg package. > > My code uses tesseract library, i.e. libtesseract-dev. Since a > libtesseract-dbg package is not available, I probably have to compile it > myself. As far as I know the Ubuntu dbg packages are built automatically just as the Fedora debuginfo ones are, so I would have expected one to exist... Tom -- Tom Hughes (to...@co...) http://compton.nu/ |
|
From: João M. S. S. <joa...@gm...> - 2014-12-08 22:51:44
|
> As far as I know the Ubuntu dbg packages are built automatically just as > the Fedora debuginfo ones are, so I would have expected one to exist... You are right. I looked for it and found additional repos with the -dbgsym package for libtesseract3. The repos are located at http://ddebs.ubuntu.com Thanks, this improves my already excellent experience with valgrind. -- João M. S. Silva |