AOSP 模拟器内存​​很快就被填满

发布于 2025-01-10 17:22:49 字数 710 浏览 0 评论 0原文

我目前正在与 AOSP 合作,为 Android Automotive OS 构建一个应用程序。我在两台不同的 PC(都运行 Ubuntu)上编译了相同的代码(从版本控制中检出)。在其中之一(使用 Intel CPU)上,模拟器启动良好并且稳定。

在另一台 PC(AMD CPU)上,模拟器会启动,但很快就会因 OutOfMemory 错误而崩溃。 AOSP 正在快速终止所有进程,然后终止其系统进程,最后由于“系统在内存上死锁”而重新启动。

我发现罪魁祸首是一个系统进程。它囤积了大量的内存: android.hardware.automotive.vehicle 进程正在囤积内存。它持续快速增长,最后操作系统重新启动。

当我使用 meminfo 工具检查进程的内存使用情况时,我发现以下内容: android.hardware.automotive.vehicle 进程使用超过 2GB 的 RAM。

我的因此问题是:

  1. 你知道发生了什么吗?
  2. 如何调试这个系统进程?
  3. 为什么一台 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:

  1. Do you what is happening?
  2. How can I debug this system process?
  3. Why is the system process behaving differently on one PC compared to another PC?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谁人与我共长歌 2025-01-17 17:22:49

对于遇到此问题的人:

经过大量摆弄后,我发现将自定义车辆属性添加到 VHAL 定义中(想想 types.halDefaultConfig.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 and DefaultConfig.h files) must be done very carefully. In my case, I added a vehicle property with VehiclePropertyChangeMode set to CONTINUOUS, 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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文