sherpa-onnx icon indicating copy to clipboard operation
sherpa-onnx copied to clipboard

Possible memory leak?

Open debasish-mihup opened this issue 1 year ago • 6 comments

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?

debasish-mihup avatar Sep 13 '23 10:09 debasish-mihup

memory growth over time, although the growth is small

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

csukuangfj avatar Sep 13 '23 12:09 csukuangfj

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

debasish-mihup avatar Sep 13 '23 13:09 debasish-mihup

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 avatar Sep 13 '23 22:09 csukuangfj

Any update on this issue?

csukuangfj avatar Sep 18 '23 07:09 csukuangfj

Any update on this issue?

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

kafan1986 avatar Oct 09 '23 13:10 kafan1986

Any updates on this?

austings avatar May 18 '24 00:05 austings