k2-fsa / sherpa-onnx

Speech-to-text, text-to-speech, speaker recognition, and VAD using next-gen Kaldi with onnxruntime without Internet connection. Support embedded systems, Android, iOS, Raspberry Pi, RISC-V, x86_64 servers, websocket server/client, C/C++, Python, Kotlin, C#, Go, NodeJS, Java, Swift, Dart, JavaScript, Flutter, Object Pascal, Lazarus, Rust
https://k2-fsa.github.io/sherpa/onnx/index.html
Apache License 2.0
3.11k stars 360 forks source link

Possible memory leak? #309

Open debasish-mihup opened 12 months ago

debasish-mihup commented 12 months ago

I am using zipformer with online model (streaming mode) using C APIs on android platform, the ASR functionality is working OK. In my code during constructor call, I am initializing and keeping the recognizer object and stream object in a class variable and only free them during destructor call. During the entire lifecycle of application, constructor will be called once during start of the app and the during exit of the application, the destructor is called. I am using reset functionality to reset stream and recognizer object across different ASR commands.

But I am seeing a ever increasing (although) memory growth over time, although the growth is small and unpredictable across iteration. Valgrind and other analyzer tools are unable to pinpoint the issue. Has anyone here observed this issue?

csukuangfj commented 12 months ago

memory growth over time, although the growth is small

Could you describe the amount it grows? And how long have you run it?

debasish-mihup commented 12 months ago

memory growth over time, although the growth is small

Could you describe the amount it grows? And how long have you run it?

I have ran it for about 8-10 hours. Making a dummy streaming ASR call every 1 minute. Each such audio command is around 4-5 second long feed to the streaming ASR in chunks of 0.1 second (1600 samples). The memory growth over 8 - 10 hours period is around 125 MB using initial memory as baseline

csukuangfj commented 12 months ago

memory growth over time, although the growth is small

Could you describe the amount it grows? And how long have you run it?

I have ran it for about 8-10 hours. Making a dummy streaming ASR call every 1 minute. Each such audio command is around 4-5 second long feed to the streaming ASR in chunks of 0.1 second (1600 samples). The memory growth over 8 - 10 hours period is around 125 MB using initial memory as baseline

Since you are using the C API, you have to free resources by yourself for some function calls. Could you please post the code about how you use the C APIs?

csukuangfj commented 11 months ago

Any update on this issue?

kafan1986 commented 11 months ago

Any update on this issue?

I am planning to work on this issue and shall share any updates accordingly.

austings commented 3 months ago

Any updates on this?