Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat:Improve the usage of the Recognizer in the Demo to reduce memory… #212

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fanmingyi
Copy link

我看到作者会中文加之我的英文较差怕引起歧义使用中提出此PR。

这一个非常棒的项目,帮我解决了一些项目中的问题。

(1) 我发现Demo在持续运行时内存不断增加。点击停止后按钮内存依旧没有回收。
在翻阅Issues发现类似问题类似Issues

我发现问题有两个:
问题1. Recognizer在Native指针始终没有释放所以点击停止录音并没有释放对应内存
问题2. 持续录制时会不断存储缓存并从不释放,比较核心的代码如下。Expand内部代码内部调用PushArc将内存占用情况劣化。openfst我看到有内存gc机制由于我对于音视频知识匮乏暂无往下继续研究。这个情况我在IOS也发现存在。

//openfst arc-map.h 
size_t NumArcs(StateId s) {
    if (!HasArcs(s)) Expand(s);
    return CacheImpl<B>::NumArcs(s);
  }
size_t NumInputEpsilons(StateId s) {
    if (!HasArcs(s)) Expand(s);
    return CacheImpl<B>::NumInputEpsilons(s);
  }

此PR主要解决问题1

@fanmingyi
Copy link
Author

在使用PR停止录音内存有回落,如下图

cOcEXhZeuy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant