In certain situations, I create an EditText, pass the value to another Fragment, and then call removeAllViews on the ViewGroup that the EditText belongs to remove EditText.
The problem is that the InputConnectionWrapper associated with the EditText is still occupying memory.
In the above Heap Dump, the InputConnectionWrapper is allocated over 300 and takes up considerable memory.
However, with the Heap Dump enabled, there is only one EditText in the Activity, and it is judged that the InputConnectionWrapper is not created due to the corresponding EditText.
To close the InputConnectionWrapper, I tried the following function.
TextKeyListener.clear(editText.getText());
editText.setHint(null);
editText.removeTextChangedListener(this);
editText=null;
// The ViewGroup will then execute removeAllViews.
However, the InputConnectionWrapper seems to be allocated more over time as it is not finalized.
What is the reason InputConnectionWrapper will not be finalized?