高 ram 使用率和同一进程显示多次?
High ram usage and same process showing multiple times?
我在 Android Studio 中制作了一个媒体播放器,它使用 Service 来控制播放。
现在一切正常,我没有注意到任何延迟,即使我的 logcat 说在启动过程中跳过了 123 帧。
我在某处读到如果这条消息不超过 300+ 跳过的帧 就可以忽略,但现在我不太确定了,因为我现在甚至读到了跳过 1 帧太多了。
我还将内存使用量与商店中的 mp3 播放器进行了比较,我注意到大多数媒体播放器的内存使用量都低于 10mb。
但是我的几乎超过了 50mb 我不知道为什么但是如果你查看详细信息你会发现有很多同名的进程 'sandboxed_processes'.
所以我的问题是我的应用程序几乎消耗 50mb 内存是否正常,以及那些“sandboxed_processes”是什么意思。
问题 1 :
这取决于您的应用程序正在使用和需要多少资源。您应该认真对待内存,并且应该尽可能少地使用。垃圾收集器将帮助您回收分配的内存,但您应该考虑您创建的任何对象实例的生命周期,以及它们的设计以最小化结构。最后但同样重要的是,Studio 允许您分析应用程序的内存分配,因此请使用它 :) .
问题 2 :
来自官方的Application Sandbox documentation
The Android platform takes advantage of the Linux user-based
protection to identify and isolate app resources. This isolates apps
from each other and protects apps and the system from malicious apps.
To do this, Android assigns a unique user ID (UID) to each Android
application and runs it in its own process.
Android uses this UID to set up a kernel-level Application Sandbox.
The kernel enforces security between apps and the system at the
process level through standard Linux facilities, such as user and
group IDs that are assigned to apps. By default, apps can't interact
with each other and have limited access to the operating system. For
example, if application A tries to do something malicious, such as
read application B's data or dial the phone without permission (which
is a separate application), then the operating system protects against
this behavior because application A does not have the appropriate user
privileges. The sandbox is simple, auditable, and based on decades-old
UNIX-style user separation of processes and file permissions.
Because the Application Sandbox is in the kernel, this security model
extends to native code and to operating system applications. All of
the software above the kernel, such as operating system libraries,
application framework, application runtime, and all applications, run
within the Application Sandbox. On some platforms, developers are
constrained to a specific development framework, set of APIs, or
language in order to enforce security. On Android, there are no
restrictions on how an application can be written that are required to
enforce security; in this respect, native code is as sandboxed as
interpreted code.
我在 Android Studio 中制作了一个媒体播放器,它使用 Service 来控制播放。
现在一切正常,我没有注意到任何延迟,即使我的 logcat 说在启动过程中跳过了 123 帧。
我在某处读到如果这条消息不超过 300+ 跳过的帧 就可以忽略,但现在我不太确定了,因为我现在甚至读到了跳过 1 帧太多了。
我还将内存使用量与商店中的 mp3 播放器进行了比较,我注意到大多数媒体播放器的内存使用量都低于 10mb。
但是我的几乎超过了 50mb 我不知道为什么但是如果你查看详细信息你会发现有很多同名的进程 'sandboxed_processes'.
所以我的问题是我的应用程序几乎消耗 50mb 内存是否正常,以及那些“sandboxed_processes”是什么意思。
问题 1 :
这取决于您的应用程序正在使用和需要多少资源。您应该认真对待内存,并且应该尽可能少地使用。垃圾收集器将帮助您回收分配的内存,但您应该考虑您创建的任何对象实例的生命周期,以及它们的设计以最小化结构。最后但同样重要的是,Studio 允许您分析应用程序的内存分配,因此请使用它 :) .
问题 2 :
来自官方的Application Sandbox documentation
The Android platform takes advantage of the Linux user-based protection to identify and isolate app resources. This isolates apps from each other and protects apps and the system from malicious apps. To do this, Android assigns a unique user ID (UID) to each Android application and runs it in its own process.
Android uses this UID to set up a kernel-level Application Sandbox. The kernel enforces security between apps and the system at the process level through standard Linux facilities, such as user and group IDs that are assigned to apps. By default, apps can't interact with each other and have limited access to the operating system. For example, if application A tries to do something malicious, such as read application B's data or dial the phone without permission (which is a separate application), then the operating system protects against this behavior because application A does not have the appropriate user privileges. The sandbox is simple, auditable, and based on decades-old UNIX-style user separation of processes and file permissions.
Because the Application Sandbox is in the kernel, this security model extends to native code and to operating system applications. All of the software above the kernel, such as operating system libraries, application framework, application runtime, and all applications, run within the Application Sandbox. On some platforms, developers are constrained to a specific development framework, set of APIs, or language in order to enforce security. On Android, there are no restrictions on how an application can be written that are required to enforce security; in this respect, native code is as sandboxed as interpreted code.