jeremyandrews / kakaia

Kakaia personal assistant
MIT License
13 stars 0 forks source link

fix memory leak #1

Closed jeremyandrews closed 4 years ago

jeremyandrews commented 4 years ago

Currently each time we convert audio to text the kakaia process grows by a few hundred kilobytes. Need to track down where the memory is leaking, and fix.

jeremyandrews commented 4 years ago

The leak is because we're loading the model into memory each time we convert an audio file to text, where we should only be loading it one time. The logic in src/speech.rs needs to be reworked to only load the models into memory one time and then re-use.

jeremyandrews commented 4 years ago

Fixed in https://github.com/jeremyandrews/kakaia/commit/e5247c9afe8ee9c14da41efac2288efa9989dfc6

We now load the deepspeech::Model only one time at launch and share it to all threads with a mutex.