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

内存泄漏隐患? #429

Closed
izxyz opened this issue Jul 24, 2023 · 3 comments
Closed

内存泄漏隐患? #429

izxyz opened this issue Jul 24, 2023 · 3 comments
Labels

Comments

@izxyz
Copy link

izxyz commented Jul 24, 2023

native层没有看到lua层对jni调用统计的代码, 那么在lua虚拟机异常停止后, 在lua层比如self.env[0]FindClass申请到的内存会不会得不到释放从而导致泄漏?

@pazos
Copy link
Member

pazos commented Jul 24, 2023

The code path on a error/crash is in https://github.com/koreader/android-luajit-launcher/blob/master/jni/main.c#L205-L208

We finish the NativeActivity, which is the proper thing to do. Albeit the framework will do it for us in case we don't exist cleanly, but that shouldn't happen.

Finishing the nativeActivity makes the zygote forked process where the app lives to be killed, so no memory leaks are possible here, until I miss something.

Do you have a test case that shows how an anormal exist would lead to memory leaks?

@pazos pazos added the question label Jul 24, 2023
@izxyz
Copy link
Author

izxyz commented Jul 24, 2023

现在只是我的假想, 我还没有运行起来.因为在我的设备上无法运行
华为p30pro
hoarmonyOS3.0
9404fc483a0b7d67ac7855b7c70909c

@pazos
Copy link
Member

pazos commented Jul 24, 2023

Yes. The app is just a shell. You need to add lua code to make it work. Have a look at examples/hello world

@pazos pazos closed this as completed Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants