Is there a memory leak in localspeechrecognition?

Hello!

I have noticed this in Sonoma and in the betas for Sequoia, the ARM variants. I am using the example from https://github.com/sveinbjornt/hear?tab=readme-ov-file in an attempt to cobble together an all-in-one transcription and low-level grammar checker utilizing LanguageTool.

I have noticed that the ram usage, specifically the swap, just keeps on climbing while it is processing an audio file. It is... quite amazing to see exactly how much swap the dang thing can use in a pinch. Frighteningly so considering the Mini I am using only has 256gb of storage.

Throw an eight hour mp3 audiobook at the process and see for yourself.

I am aware that localspeechrecognition wasn't really designed with the idea that people will be throwing audio files at it, so it is understandable that it wouldn't be equipped to gracefully handle this situation.

I am a novice programmer here. Seriously - this is my first major stab at programming since dabbling with Qbasic back in elementary school. Thus, this question: if there is a memory leak, is there a way to shunt the swap being used by the app to an external drive? I am willing to take the performance hit if it keeps the internal SSD from paying the ferryman sooner than expected due to excessive swap usage.

Thanks!

Answered by DTS Engineer in 797750022

Thus, this question: if there is a memory leak, is there a way to shunt the swap being used by the app to an external drive? I am willing to take the performance hit if it keeps the internal SSD from paying the ferryman sooner than expected due to excessive swap usage.

No, or at least not one that can be implemented "underneath" an existing app. In theory you can allocate memory through general memory mapping ("mmap"), but that isn't something you can do "underneath" existing app/framework. Similarly, while it's technically possible to move the swap volume to "something" else, we haven't documented what's involved, it's changed significantly over time, and it's not something I'd call particularly "safe". Realistically, the right answer here is to file bugs so we can fix these issues.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

Accepted Answer

Thus, this question: if there is a memory leak, is there a way to shunt the swap being used by the app to an external drive? I am willing to take the performance hit if it keeps the internal SSD from paying the ferryman sooner than expected due to excessive swap usage.

No, or at least not one that can be implemented "underneath" an existing app. In theory you can allocate memory through general memory mapping ("mmap"), but that isn't something you can do "underneath" existing app/framework. Similarly, while it's technically possible to move the swap volume to "something" else, we haven't documented what's involved, it's changed significantly over time, and it's not something I'd call particularly "safe". Realistically, the right answer here is to file bugs so we can fix these issues.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

Thanks for the direction. In the meantime I am keeping my audio files down below an hour. It appears that the issue doesn't crop up until the audio file runs well beyond what most people would consider reasonable for a recording.

Is there a memory leak in localspeechrecognition?
 
 
Q