Open yousifa opened 3 weeks ago
I can confirm this. Sometimes the memory loss is up to 30MB.
Yep, the amount it retains seems inconsistent and random
Thanks for reporting. I'll take a look in the next days. Let me know if you find what is the resource that leaks or the commit that caused the regression.
Thanks, I'm looking into it too. This issue has existed for at least 6 months, as that was the version I was using when i first noticed it (and it still exists in the latest).
@ggerganov any updates here?
Nope, haven't looked into this yet. Did you find anything on your end?
I'm not very good with Swift: would this deinit
function get called when you set the WhisperContext = nil
?
I suppose if this is like a destructor in C++, then it would get called.
if there is no strong reference
to the WhisperContext object, it should call the deinit
Thanks @Josscii. So @yousifa and @chnbr, make sure that this whisper_free
is called in your code. If it is and it still leaks, then provide the most basic example Swift program that reproduces the issue and instructions how to run it.
Thanks @Josscii. So @yousifa and @chnbr, make sure that this whisper_free is called in your code.
At least on my side it definitely is. In Xcode debugger it is easy to monitor the memory consumption. One of the first things I learned is to call whisper_free. Otherwise we would leak a few hundred MB of memory depending on the model.
The thing is however that after calling whisper_free the consumption does not drop to the amount of before initialising whisper. I would expect that some allocs during operation are not free'd properly.
Yes, whisper_free
is called in the deinit and i call it manually as well. We'll get you a sample project shortly.
Deallocating WhisperContext (from swift) will leave memory allocated (1-10mb)
To replicate: Call WhisperContext() and then set it to nil in the demo whisper swiftui app repeatedly. Memory will continue growing.