单例造成内存泄漏

直接上源码:

public class PostListFragment extends Fragment {

public Context mContext;

private static PostListFragment mInstance = null;

public static PostListFragment getInstance() {

if (mInstance == null) {

mInstance = new PostListFragment();

}

return mInstance;

}

@Override

public void onAttach(Context context) {

super.onAttach(context);

this.mContext = context;

}

}

用检测内存泄漏的工具之后提示发生内存泄漏,

* static PostListFragment.mInstance

* references PostListFragment.mContext

* leaks MainActivity instance

但是我认为mInstance没有引用mContext?

求解释???

你可能感兴趣的:(单例造成内存泄漏)