vosk-api icon indicating copy to clipboard operation
vosk-api copied to clipboard

Memory Leak Issues with Vosk using NodeJS

Open dzlandis opened this issue 2 years ago • 9 comments

I'm having memory leak issues with Vosk. By default, just starting up the program I've implemented Vosk with uses about 150mb of RAM. Everytime a user talks, the memory keeps increasing and never decreases until the program completely crashes and has to restart due to lack of memory. I'm not sure how to fix it and it appears to be directly related to Vosk.

dzlandis avatar Oct 03 '21 20:10 dzlandis

Which version? Which model?

nshmyrev avatar Oct 03 '21 20:10 nshmyrev

Which version? Which model?

Vosk NPM package is v0.3.31 I'm using vosk-model-small-en-us-0.15

dzlandis avatar Oct 03 '21 23:10 dzlandis

How much memory do you have in total?

nshmyrev avatar Oct 03 '21 23:10 nshmyrev

What is your hardware?

nshmyrev avatar Oct 03 '21 23:10 nshmyrev

I've tested both on my PC (with 12GB of RAM), and my server environment which is in a PM2 container allowing for 2.5GB max of RAM before auto restarting. The PM2 server environment restarts frequently due to Vosk memory problems and the RAM increase is more visible because of multiple transcriptions happening at once. On my PC, it doesn't crash because there is a lot of RAM, but the memory increase is still apparent despite transcribing less users at once.

My PC hardware is as follows: Processor: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz, 3401 Mhz, 4 Core(s), 8 Logical Processor(s) 12GB of RAM

PM2 Server Enviornment hardware: Processor: Intel(R) Xeon(R) CPU E5-2697 v2 @ 2.70GHz 2.5 GB of available RAM in PM2 container, 4GB of RAM on full server.

Let me know if you need any more info. 😀

dzlandis avatar Oct 03 '21 23:10 dzlandis

What is your OS?

nshmyrev avatar Oct 03 '21 23:10 nshmyrev

What is node version?

nshmyrev avatar Oct 04 '21 00:10 nshmyrev

What is your OS?

PC is Windows Server Environment is Ubuntu (Linux)

What is node version?

PC is v16 Server Environment is v12

dzlandis avatar Oct 04 '21 00:10 dzlandis

I'm also having increasing memory usage using the vosk-model-en-us-librispeech-0.2 on Node 20 and Ubuntu.

I have 8GB memory on the machine and an 8GB swap.

I create one model and free up the Recognizer and Model after each use.

Using htop, I can see the memory steadily going up after each request.. even with idle time in between.

mattkenefick avatar Aug 09 '23 15:08 mattkenefick