简体   繁体   English

如何在Android JNI中释放字符串?

[英]How to release strings in Android jni?

I see alot of post concerning the Android Jni but I still do not have a clear idea how to edit it. 我看到了很多有关Android Jni的帖子,但是我仍然不清楚如何进行编辑。 I have a Phonegap app that is having JNI Errors when loading a certain page. 我有一个Phonegap应用,该应用在加载特定页面时出现JNI错误。

From what I have read during research, I need to release the local storage. 根据研究期间所读的内容,我需要释放本地存储。 How do I do this, I am wondering. 我想知道我该怎么做。

All I see to do it but no real clear path on what to do. 我所看到的只是要做的事情,但没有明确的方法去做。

If you were going to either release localRef strings or create a globalRef string What would you do? 如果要发布localRef字符串或创建globalRef字符串,该怎么办?

Thanks ahead. 谢谢你

So you have already created 512 local references and you need to create more. 因此,您已经创建了512个本地引用,还需要创建更多本地引用。 You either have to release some of the ones you've already created, via DeleteLocalRef() , if that makes sense in your code, or else request more local slots, via EnsureLocalCapacity() or PushLocalFrame() . 您必须通过DeleteLocalRef()释放已经创建的某些代码DeleteLocalRef()如果这在您的代码中有意义的话DeleteLocalRef() ,否则,可以通过EnsureLocalCapacity()PushLocalFrame()请求更多本地插槽。 I prefer the latter in conjunction with PopLocalFrame() : many coding patterns fit into it, maybe yours. 我更喜欢将后者与PopLocalFrame()结合使用:许多编码模式都适合其中,也许是您自己的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM