AOSP 模拟器内存很快就被填满
我目前正在与 AOSP 合作,为 Android Automotive OS 构建一个应用程序。我在两台不同的 PC(都运行 Ubuntu)上编译了相同的代码(从版本控制中检出)。在其中之一(使用 Intel CPU)上,模拟器启动良好并且稳定。
在另一台 PC(AMD CPU)上,模拟器会启动,但很快就会因 OutOfMemory 错误而崩溃。 AOSP 正在快速终止所有进程,然后终止其系统进程,最后由于“系统在内存上死锁”而重新启动。
我发现罪魁祸首是一个系统进程。它囤积了大量的内存: android.hardware.automotive.vehicle 进程正在囤积内存。它持续快速增长,最后操作系统重新启动。
当我使用 meminfo 工具检查进程的内存使用情况时,我发现以下内容: android.hardware.automotive.vehicle 进程使用超过 2GB 的 RAM。
我的因此问题是:
- 你知道发生了什么吗?
- 如何调试这个系统进程?
- 为什么一台 PC 上的系统进程与另一台 PC 上的行为不同?
I'm currently working with AOSP and building an app for the Android Automotive OS. I have compiled the same code (checked out from version control) on two different PCs (both running Ubuntu). On one of them (with an Intel CPU) the emulator starts up fine and the emulator is stable.
On the other PC (an AMD CPU) the emulator starts up, but will quickly crash with OutOfMemory errors. AOSP is quickly killing all processes, then its system processes and finally reboots due to 'System is deadlocked on memory'.
I found that the culprit is a system process. It hoards a lot of memory:
the android.hardware.automotive.vehicle process is hoarding memory. It keeps growing very quickly and finally the OS reboots.
When I use the meminfo tool to inspect memory usage of the process, I find the following:
The android.hardware.automotive.vehicle process is using over 2GB of RAM.
My questions thus are:
- Do you what is happening?
- How can I debug this system process?
- Why is the system process behaving differently on one PC compared to another PC?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于遇到此问题的人:
经过大量摆弄后,我发现将自定义车辆属性添加到 VHAL 定义中(想想
types.hal
和DefaultConfig.h
文件)必须非常小心地完成。就我而言,我添加了一个车辆属性 VehiclePropertyChangeMode 设置为CONTINUOUS
,但未添加 最小值 和 最大采样率。这导致 android.hardware.automotive.vehicle 服务出于某种原因不断请求越来越多的内存,最终模拟器崩溃。如果您想防止这种情况发生,请确保在您的
DefaultConfig.h
文件中添加 minSampleRate 和 maxSampleRate!For those who ran into this issue:
After a lot of fiddling around, I found that adding custom vehicle properties to the VHAL definitions (think of the
types.hal
andDefaultConfig.h
files) must be done very carefully. In my case, I added a vehicle property with VehiclePropertyChangeMode set toCONTINUOUS
, but did not add a minimum and maximum sample rate. This caused the android.hardware.automotive.vehicle service to keep requesting more and more memory for some reason and finally the emulator would crash.If you want to prevent this from happening, make sure to add a minSampleRate and maxSampleRate in your
DefaultConfig.h
file!