每次我更换Fragment内存使用量增加

时间:2016-03-02 16:05:36

标签: android android-fragments view memory-leaks

您可以在

下找到我的片段替换代码和内存泄漏防护尝试
  FragmentManager manager = getSupportFragmentManager();
    FragmentTransaction transaction = manager.beginTransaction();
    transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE);
    transaction.replace(R.id.fragment_container, f);
    transaction.addToBackStack(null);
    transaction.commit();

示例onDestroyView //我将每个全局变量视图指定为null

    @Override
    public void onDestroyView() {

    propertyList = null;
    pa = null;
    db = null;

    mainView = null;
    super.onDestroyView();
}

我在引用上下文的每个片段destroy方法上为每个视图赋值null。但是分配null对记忆没有任何好处。我在哪里做错了?

0 个答案:

没有答案