gpt4 book ai didi

java - 仅使用框架布局分配大量内存

转载 作者:行者123 更新时间:2023-12-02 02:52:18 25 4
gpt4 key购买 nike

当我打开此 Activity 时,分配的内存从 11MB 增加到几乎 50MB..

在此 Activity 中,我只有一个带有图像的框架布局..并且我使用 onTouchEvent 移动点图像..

谁能告诉我为什么我用了这么多内存?即使当我按后退按钮离开 Activity 时,分配的内存仍为 50MB

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/fl"
tools:context="it.uniroma3.sensorlog">

<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@mipmap/mappa"
android:id="@+id/map"/>

<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:src="@android:drawable/ic_notification_overlay"
android:id="@+id/dot"
/>

</FrameLayout>

最佳答案

重点是:我们无法知道。

事实是:此内存以某种方式被您的应用程序消耗。只有能够运行和分析。

因此,这里最根本的答案是:学习如何使用相应的工具;去想想吧。

好的起点是 here ,或其他现有的 question关于这个主题。

鉴于您的评论;另一个答案:第一个直接实验可以是:选择一组非常小的小图像;看看这是否有所作为。如果是的话;您知道在哪里进行搜索。

关于java - 仅使用框架布局分配大量内存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43605641/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com