1.问题代码的编写与正确代码(这里会产生多个对象):
xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
tools:context=".MainActivity">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:onClick="click"/>
</androidx.constraintlayout.widget.ConstraintLayout>
2.开始检测与操作流程
1.先运行软件在打开profile
2.点击这里进入memory
3.开始记录:点击record,点击按钮触发产生内存问题,然后stop
查找问题的所在(4点)