pocketsphinx
pocketsphinx copied to clipboard
memory allocation error on iphone for fsg decoder
Memory allocation error on ps_search_step
while ((nfr = acmod_process_raw(acmod1, &bptr, &nread, TRUE)) > 0) { while (acmod1->n_feat_frame > 0) { ps_search_step(ngs1, acmod1->output_frame); acmod_advance(acmod1); } fprintf(stderr, "\nprocessed %d frames\n", nfr); }
device: iPhone 7plus, iOS11+
Following is the crash log.
Crashed: NSOperationQueue 0x1c4036ee0 (QOS: UNSPECIFIED) 0 libsystem_kernel.dylib 0x1818612e0 pthread_kill + 8 1 libsystem_pthread.dylib 0x181a02288 pthread_kill$VARIANT$mp + 376 2 libsystem_c.dylib 0x1817cfd0c abort + 140 3 libsystem_malloc.dylib 0x1818a77d4 nano_ptr_in_use_enumerator + 330 4 libsystem_malloc.dylib 0x1818a9bd4 nano_malloc_check_clear + 416 5 libsystem_malloc.dylib 0x1818a8a1c nano_calloc + 80 6 libsystem_malloc.dylib 0x18189a02c malloc_zone_calloc + 168 7 libsystem_malloc.dylib 0x181899f60 calloc + 40 8 SpeechDecoding 0x101055314 _ckd_calloc + 1263988 9 SpeechDecoding 0x10105a13c glist_add_ptr + 1283996 10 SpeechDecoding 0x101005aa8 fsg_history_entry_add + 938248 11 SpeechDecoding 0x101007c00 fsg_search_null_prop + 946784 12 SpeechDecoding 0x10100798c fsg_search_step + 946156 13 SpeechDecoding 0x100e44c2c test_decode_ptm (phone_decode.c:76) 14 SpeechDecoding 0x100e450a8 execute_phone_sequence_ptm (phone_decode.c:283) 15 SpeechDecoding 0x100e4774c runPhoneSequence (PocketSphinxProcessor.m:212) 16 SpeechDecoding 0x100df3628 -[PocketSphinxManager runPLDecoderForRecordingFile:allpFile:mlqFlag:oneWordFlag:] (PocketSphinxManager.m:1199) 17 SpeechDecoding 0x100df3950 -[PocketSphinxManager runPLDecoderForRecordingFile:outFDir:mlqFlag:oneWordFlag:] (PocketSphinxManager.m:1255) 18 SpeechDecoding 0x100df1fa0 80-[PocketSphinxManager processPronunciationForRecordingFileAsync:phrase:outFDir:]block_invoke.226 (PocketSphinxManager.m:660) 19 Foundation 0x182802e88 _NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK + 16 20 Foundation 0x1827448d0 -[NSBlockOperation main] + 72 21 Foundation 0x182743cac -[__NSOperationInternal _start:]
- 848 22 Foundation 0x18280476c __NSOQSchedule_f + 404 23 libdispatch.dylib 0x1816cca60 _dispatch_client_callout + 16 24 libdispatch.dylib 0x1816d4e94 _dispatch_continuation_pop$VARIANT$mp + 424 25 libdispatch.dylib 0x1816d37cc _dispatch_async_redirect_invoke$VARIANT$mp + 604 26 libdispatch.dylib 0x1816d9cac _dispatch_root_queue_drain + 588 27 libdispatch.dylib 0x1816d99fc _dispatch_worker_thread3 + 120 28 libsystem_pthread.dylib 0x1819fffac _pthread_wqthread + 1176 29 libsystem_pthread.dylib 0x1819ffb08 start_wqthread + 4
Can you provide a Minimal, Complete, and Verifiable Example?
Because your log mentions:
- phone_decode.c with at least 284 lines of code
- PocketSphinxProcessor.m with at least 213 lines of code
- PocketSphinxManager.m with at least 1256 lines of code
And none of those files are part of pocketsphinx repository.
Note that you are showing us a piece of code very similar to https://github.com/cmusphinx/pocketsphinx/blob/master/test/unit/test_state_align.c#L24, but with an fprintf
added, which means you're on some fork of some sort. Here, in pocketsphinx repository, the "Test bad alignment" is done on "<s> go forward ten meters </s>"
which is too small to cause any memory issue: can you provide the dictionary that has caused your memory allocation error?