与 Android NDK 库关联的可用内存
我正在完成一个 Android 程序,用于对手机上的歌曲类型进行分类。分类代码是在本机共享库中实现的(不是我编写的)。不幸的是,它只在第一次正确分类,此后的任何时候它都只返回之前的结果。我认为这与代码中的某些变量被声明为静态并且它们没有在分类之间正确实例化这一事实有关。
我需要知道如何在每次分类后释放与本机库关联的内存,以便所有变量在下一个分类中正确实例化。
我当前通过类调用本机库,我可以显式“释放”该类(如 C/C++ 中的类)而不等待垃圾收集器吗?
I am completing an Android program to classify the genre of a song on a mobile phone. The classification code is implemented in a native shared library (not written by me). Unfortunately, it only classifies correctly the first time, any times after then it just returns the previous result. I was thinking this was to do with the fact that some of the variables in the code are declared static and that they are not being instantiated properly between classifications.
I need to know how I can free the memory associated with a native library after each classification so that all the variables are instantiated correctly in the next classification.
I currently call the native library via a class, can I 'free' the class (like in C/C++) explicitly without waiting for the garbage collector?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
@qrtt1 是对的,在代码中搜索了重置功能,我找到了一个......谢谢!
@qrtt1 was right, searched through the code for a reset function and I found one... thanks!