I have a simple Activity with only one button to popup a simple dialog. Code is:
1. MainActivity.java
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void showDialogBlank(View dumbView) {
AlertDialog.Builder dlgBuilder = new AlertDialog.Builder(this);
dlgBuilder.setTitle("TEST-TITLE")
.create()
.show();
}
}
2. activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/btnShowDialogBlank"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="showDialogBlank"
android:text="btn-blank" />
</LinearLayout>
After I click the button & empty area multiple times, the memory is like:
Mainly, the Native memory grows by ~3.6MB, which cannot be GC... Why is that?
from Android AlertDialog leaks memory when show & dismiss multiple times?
No comments:
Post a Comment