简体   繁体   English

在tess-2中调用end()方法导致应用程序崩溃

[英]Call end() method in tess-two is causing app crash

I'm using tess-two without problems, but when I call the TessBaseAPI.end() the application crashes. 我使用的是tess-2,没有问题,但是当我调用TessBaseAPI.end()时,应用程序崩溃了。 This log message is displayed. 显示此日志消息。

06-26 09:06:18.065   2347-14702/? I/ActivityManager﹕ Killing proc 14146:br.com.nglauber.app.ocr/u0a10163: force stop br.com.nglauber.app.ocr
06-26 09:06:18.065   2347-14702/? W/ActivityManager﹕ Force removing ActivityRecord{431661d8 u0 br.com.nglauber.app.ocr/br.com.nglauber.app.payoff.PayoffActivity}: app died, no saved state
06-26 09:06:18.230    2347-2461/? D/CrashAnrDetector﹕ Build: samsung/m0ub/m0:4.3/JSS15J/I9300UBUGNL1:user/release-keys
    Hardware: smdk4x12
    Revision: 12
    Bootloader: I9300UBUGNL1
    Radio: unknown
    Kernel: Linux version 3.0.31-2812098 (se.infra@SWDA2610) (gcc version 4.4.3 (GCC) ) #1 SMP PREEMPT Tue Dec 16 22:20:53 KST 2014
    *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    Build fingerprint: 'samsung/m0ub/m0:4.3/JSS15J/I9300UBUGNL1:user/release-keys'
    Revision: '12'
    pid: 14146, tid: 14663, name: Thread-1376  >>> br.com.nglauber.app.ocr <<<
    signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 000000a8
    r0 5ee9d660  r1 00000020  r2 00000001  r3 00000000
    r4 0000006f  r5 64ed19c8  r6 5ee9ce90  r7 60cea2f8
    r8 60bafa48  r9 64f3c868  sl 00000018  fp 000000fe
    ip 60eac448  sp 64362390  lr 607a9da7  pc 607a9d9e  cpsr 88000030
    d0  01a56e1fc2f8f359  d1  3f11155ab300621e
    d2  3f1114d75eadfb55  d3  3fe188c800000000
    d4  407f400000000000  d5  3f71c92245382f5d
    d6  3f71c92245382f5d  d7  000000fe3f7ee36e
    d8  000000003f800000  d9  0000000000000000
    d10 0000000000000000  d11 0000000000000000
    d12 0000000000000000  d13 0000000000000000
    d14 0000000000000000  d15 0000000000000000
    d16 403ec1e0872ff28d  d17 bfa2b4442c6a6c2f
    d18 3e64852cd8c08bf7  d19 3fc4c82f9669a9cd
    d20 3ca1a62633145c07  d21 3fc249249976c1af
    d22 bfbc71c70ac3a12e  d23 3fb745cdd03b7830
    d24 bfb3b0f2b9082f3f  d25 3fb10d66a8fbcae1
    d26 bfadde2d5edd7fa8  d27 3fa97b4b29cee400
    d28 3f90ad3ae322da11  d29 3f29a0080575b857
    d30 3fd555555b323d4d  d31 bfc99999a2b7aa58
    scr 68000093
    backtrace:
    #00  pc 000bfd9e  /data/app-lib/br.com.nglauber.app.ocr-1/libtess.so (tesseract::Classify::ComputeCharNormArrays(FEATURE_STRUCT*, INT_TEMPLATES_STRUCT*, unsigned char*, unsigned char*)+73)
    #01  pc 000c0c7f  /data/app-lib/br.com.nglauber.app.ocr-1/libtess.so (tesseract::Classify::CharNormTrainingSample(bool, int, tesseract::TrainingSample const&, GenericVector<tesseract::UnicharRating>*)+210)
    stack:
    64362350  00000000
    64362354  0000006e
    64362358  5ee9ce90
    6436235c  64f3c868
    64362360  60bafa48
    64362364  000000ff
    64362368  64f3c868
    6436236c  607b154f  /data/app-lib/br.com.nglauber.app.ocr-1/libtess.so (tesseract::Classify::ComputeIntCharNormArray(FEATURE_STRUCT const&, unsigned char*)+54)
    64362370  3f800000
    64362374  00000000
    64362378  5ee9d660
    6436237c  0000006e
    64362380  00000001
    64362384  0000006e
    64362388  df0027ad
    6436238c  00000000
    #00  64362390  64f3c868
    64362394  64fb8600
    64362398  5ee9ce90
    6436239c  5c43be18
    643623a0  64f3c868
    643623a4  64ed19c8
    643623a8  00000056
    643623ac  00000000
    643623b0  60bafa48
    643623b4  607aac83  /data/app-lib/br.com.nglauber.app.ocr-1/libtess.so (tesseract::Classify::CharNormTrainingSample(bool, int, tesseract::TrainingSample const&, GenericVector<tesseract::UnicharRating>*)+214)
    #01  643623b8  64ed19c8
    643623bc  607b2f51  /data/app-lib/br.com.nglauber.app.ocr-1/libtess.so (tesseract::Classify::ExtractFeatures(TBLOB const&, bool, GenericVector<INT_FEATURE_STRUCT>*, GenericVector<INT_FEATURE_STRUCT>*, INT_FX_RESULT_STRUCT*, GenericVector<int>*)+276)
    643623c0  643624ac
    643623c4  64f863c0
    643623c8  00000010
    643623cc  00000004
    643623d0  4018c03c
    643623d4  00000004
    643623d8  6337a750
    643623dc  ffffffff
    643623e0  643623e8
    643623e4  608e0c14  /data/app-lib/br.com.nglauber.app.ocr-1/libtess.so
    643623e8  ff40ff40
    643623ec  00c000c0
    643623f0  00000158
    643623f4  00000010
    memory near r0:
    5ee9d640 00000001 00000000 00000000 00000000
    5ee9d650 00000000 00000000 00000000 5eea89e0
    5ee9d660 00000000 00000000 00000000 00000000
    5ee9d670 00000000 5eea8c20 608919fe 60891a10
    5ee9d680 00000000 00000000 0000000
06-26 09:06:18.230    2347-2461/? D/CrashAnrDetector﹕ processName:br.com.nglauber.app.ocr
06-26 09:06:18.230    2347-2461/? D/CrashAnrDetector﹕ broadcastEvent : br.com.nglauber.app.ocr SYSTEM_TOMBSTONE

More details: 更多细节:
- It's happening in normal app use and during my tests (using Espresso + Spoon) -这是在正常的应用程序使用过程中以及在我的测试过程中发生的(使用Espresso + Spoon)
- I'm using Samsung GT-I9300 running Android 4.3, but I think is happening in other devices too. -我使用的是运行Android 4.3的Samsung GT-I9300,但我认为其他设备也正在发生这种情况。
- Yes, I'm using the default construtor. -是的,我使用的是默认构造函数。 TessBaseAPI baseApi = new TessBaseAPI(); TessBaseAPI baseApi =新的TessBaseAPI();
- I declared baseApi as field in my class, and call setImage and getUTF8Text several times in a different Thread (problem?). -我在类中将baseApi声明为字段,并在不同的线程中多次调用setImage和getUTF8Text(问题?)。 When the Activity is destroyed, I call the end() method. 当Activity被销毁时,我调用end()方法。
- I'm using the eng.traineddata available here: https://github.com/tesseract-ocr/tessdata . -我使用的是eng.traineddata, 网址为https : //github.com/tesseract-ocr/tessdata

Any idea? 任何想法? Is there a good way to release the memory allocated by tess-two? 是否有释放tess-2分配的内存的好方法?

Calling end() is the correct way to release the memory allocated by tess-two, and running the OCR on a separate thread will help to keep your app responsive. 调用end()是释放由tess-2分配的内存的正确方法,并且在单独的线程上运行OCR将有助于保持应用程序的响应速度。

This crash is apparently happening due to calling end() while recognition is still in progress on the other thread. 由于在另一个线程上仍在进行识别时调用end(),显然导致了崩溃。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM