Closed blisssayyid closed 6 years ago
* GC ROOT android.media.PlayerBase$1.this$0 (anonymous subclass of com.android.internal.app.IAppOpsCallback$Stub)
* references android.media.MediaPlayer.mOnCompletionListener
* references com.dkaishu.zxinglib.activity.CaptureFragment$2.this$0 (anonymous implementation of android.media.MediaPlayer$OnCompletionListener)
* references com.dkaishu.zxinglib.activity.CaptureFragment.inactivityTimer
* references com.dkaishu.zxinglib.decoding.InactivityTimer.activity
* leaks com.xxxx.xxxx.activity.QRScannerActivity instance
当mediaPlayer.isPlaying()时,此时finsh当前activity时,由于mediaPlayer无法及时自动回收,当前activity会出现临时的内存泄漏,不影响正常使用,下版本将会修复。
然而好像并不只是这样的,搜了下发现貌似此问题只出现在Android7.1.1 上, it seems like an SDK leak,参考:https://github.com/square/leakcanary/issues/721 ,无法完全修复。补充:以及Android7.1.2
I think the leak you referenced is a different issue. If you look at the stack trace for the LeakCanary issue, it has only Android library classes other than the leaked activity itself. The activity reference causing this leak looks like it's coming from the implicit reference that the OnCompletionListener holds to the CaptureFragment class, and the leak may be resolvable by making your OnCompletionListener class a static inner class of your CaptureFragment class and storing a weak reference to your CaptureFragment in its constructor. Something like:
public class CaptureFragment ... {
...
static class CaptureFragmentOnCompletionListener implements OnCompletionListener {
WeakReferenced<CaptureFragment> weakCaptureFragment;
public OnCompletionListener(CaptureFragment captureFragment) {
weakCaptureFragment = new WeakReference<>(captureFragment);
}
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
CaptureFragment captureFragment = weakCaptureFragment.get();
if (captureFragment == null)
return;
...
}
}
private void setOnCompletionListener(MediaPlayer mediaPlayer) {
mediaPlayer.setOnCompletionListener(new CaptureFragmentOnCompletionListener(this));
}
}
I reproduced this leak on my phones. this is the detail logs:
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: In com.dkaishu.zxinglibexample:1.0:1.
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: * com.dkaishu.zxinglibexample.CustomActivity has leaked:
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: * GC ROOT android.media.PlayerBase$1.this$0 (anonymous subclass of com.android.internal.app.IAppOpsCallback$Stub)
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: * references android.media.MediaPlayer.mOnCompletionListener
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: * references com.dkaishu.zxinglib.activity.CaptureFragment$1.this$0 (anonymous implementation of android.media.MediaPlayer$OnCompletionListener)
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: * references com.dkaishu.zxinglib.activity.CaptureFragment.analyzeCallback
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: * references com.dkaishu.zxinglibexample.CustomActivity$2.this$0 (anonymous implementation of com.dkaishu.zxinglib.activity.CodeUtils$AnalyzeCallback)
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: * leaks com.dkaishu.zxinglibexample.CustomActivity instance
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: * Retaining: 44 KB.
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: * Reference Key: 76940184-5761-4eff-9245-734fb639bf83
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: * Device: Xiaomi Xiaomi MI 6 sagit
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: * Android Version: 7.1.1 API: 25 LeakCanary: 1.4 6b04880
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: * Durations: watch=5021ms, gc=114ms, heap dump=1190ms, analysis=141487ms
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: * Details:
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: * Instance of android.media.PlayerBase$1
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static $classOverhead = byte[240]@1894932385 (0x70f25fa1)
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | this$0 = android.media.MediaPlayer@317676928 (0x12ef5d80)
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mDescriptor = java.lang.String@1897396600 (0x7117f978)
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mObject = 548048029472
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mOwner = android.media.PlayerBase$1@315594464 (0x12cf96e0)
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | shadow$_klass_ = android.media.PlayerBase$1
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | shadow$_monitor_ = 0
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: * Instance of android.media.MediaPlayer
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static INVOKE_ID_SET_VIDEO_SCALE_MODE = 6
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_INFO_VIDEO_TRACK_LAGGING = 700
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_ERROR_UNKNOWN = 1
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_NOP = 0
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_SUBTITLE_DATA = 201
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static BYPASS_METADATA_FILTER = false
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_ERROR_SYSTEM = -2147483648
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static INVOKE_ID_GET_SELECTED_TRACK = 7
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_INFO_EXTERNAL_METADATA_UPDATE = 803
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_PAUSED = 7
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_ERROR_TIMED_OUT = -110
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_INFO_NETWORK_BANDWIDTH = 703
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_META_DATA = 202
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static VIDEO_SCALING_MODE_SCALE_TO_FIT = 1
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_ERROR_SERVER_DIED = 100
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_BUFFERING_UPDATE = 3
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_SEEK_COMPLETE = 4
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_INFO_STARTED_AS_NEXT = 2
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_INFO_SUBTITLE_TIMED_OUT = 902
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static INVOKE_ID_ADD_EXTERNAL_SOURCE_FD = 3
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_MIMETYPE_TEXT_VTT = java.lang.String@1896864920 (0x710fdc98)
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_ERROR_IO = -1004
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_INFO_METADATA_UPDATE = 802
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_PLAYBACK_COMPLETE = 2
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_ERROR_UNSUPPORTED = -1010
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_SET_VIDEO_SIZE = 5
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_INFO_BUFFERING_START = 701
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static INVOKE_ID_ADD_EXTERNAL_SOURCE = 2
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_INFO_VIDEO_RENDERING_START = 3
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static INVOKE_ID_SELECT_TRACK = 4
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_ERROR = 100
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static METADATA_ALL = false
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_SKIPPED = 9
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static INVOKE_ID_GET_TRACK_INFO = 1
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_INFO_NOT_SEEKABLE = 801
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_INFO_UNSUPPORTED_SUBTITLE = 901
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static APPLY_METADATA_FILTER = true
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING = 2
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static PLAYBACK_RATE_AUDIO_MODE_STRETCH = 1
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_ERROR_MALFORMED = -1007
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_MIMETYPE_TEXT_SUBRIP = java.lang.String@1896512912 (0x710a7d90)
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_TIMED_TEXT = 99
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_INFO_BAD_INTERLEAVING = 800
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static PLAYBACK_RATE_AUDIO_MODE_DEFAULT = 0
03-13 10:28:55.517 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static KEY_PARAMETER_AUDIO_ATTRIBUTES = 1400
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_INFO_BUFFERING_END = 702
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static $classOverhead = byte[964]@1894271737 (0x70e84af9)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static IMEDIA_PLAYER = java.lang.String@1896439872 (0x71096040)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static PLAYBACK_RATE_AUDIO_MODE_RESAMPLE = 2
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_INFO = 200
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_STARTED = 6
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_MIMETYPE_TEXT_CEA_608 = java.lang.String@1896864728 (0x710fdbd8)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK = 200
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static INVOKE_ID_DESELECT_TRACK = 5
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_MIMETYPE_TEXT_CEA_708 = java.lang.String@1896864768 (0x710fdc00)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_PREPARED = 1
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static TAG = java.lang.String@1896131672 (0x7104ac58)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_INFO_TIMED_TEXT_ERROR = 900
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_STOPPED = 8
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static MEDIA_INFO_UNKNOWN = 1
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static METADATA_UPDATE_ONLY = true
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mBypassInterruptionPolicy = false
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mEventHandler = android.media.MediaPlayer$EventHandler@315379072 (0x12cc4d80)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mInbandTrackIndices = java.util.BitSet@315585968 (0x12cf75b0)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mIndexTrackPairs = java.util.Vector@315585944 (0x12cf7598)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mListenerContext = 0
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mNativeContext = 548047072896
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mNativeSurfaceTexture = 0
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mOnBufferingUpdateListener = null
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mOnCompletionListener = com.dkaishu.zxinglib.activity.CaptureFragment$1@317663744 (0x12ef2a00)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mOnErrorListener = null
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mOnInfoListener = null
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mOnPreparedListener = null
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mOnSeekCompleteListener = null
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mOnSubtitleDataListener = null
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mOnTimedMetaDataAvailableListener = null
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mOnTimedTextListener = null
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mOnVideoSizeChangedListener = null
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mOpenSubtitleSources = java.util.Vector@315586088 (0x12cf7628)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mScreenOnWhilePlaying = false
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mSelectedSubtitleTrackIndex = -1
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mStayAwake = false
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mStreamType = 3
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mSubtitleController = android.media.SubtitleController@315428528 (0x12cd0eb0)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mSubtitleDataListener = android.media.MediaPlayer$1@315605904 (0x12cfc390)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mSurfaceHolder = null
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mTimeProvider = android.media.MediaPlayer$TimeProvider@315610520 (0x12cfd598)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mUsage = -1
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mWakeLock = null
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mAppOps = com.android.internal.app.IAppOpsService$Stub$Proxy@315605888 (0x12cfc380)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mAppOpsCallback = android.media.PlayerBase$1@315594464 (0x12cf96e0)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mAppOpsLock = java.lang.Object@315572352 (0x12cf4080)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mAttributes = android.media.AudioAttributes@315379312 (0x12cc4e70)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mAuxEffectSendLevel = 0.0
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mHasAppOpsPlayAudio = true
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mLeftVolume = 0.1
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mRightVolume = 0.1
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | shadow$_klass_ = android.media.MediaPlayer
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | shadow$_monitor_ = 0
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: * Instance of com.dkaishu.zxinglib.activity.CaptureFragment$1
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static $classOverhead = byte[112]@317438801 (0x12ebbb51)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | this$0 = com.dkaishu.zxinglib.activity.CaptureFragment@317209392 (0x12e83b30)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | shadow$_klass_ = com.dkaishu.zxinglib.activity.CaptureFragment$1
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | shadow$_monitor_ = 0
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: * Instance of com.dkaishu.zxinglib.activity.CaptureFragment
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static $classOverhead = byte[1340]@317747201 (0x12f07001)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static VIBRATE_DURATION = 200
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static BEEP_VOLUME = 0.1
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | analyzeCallback = com.dkaishu.zxinglibexample.CustomActivity$2@317419472 (0x12eb6fd0)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | beepListener = com.dkaishu.zxinglib.activity.CaptureFragment$1@317663744 (0x12ef2a00)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | callBack = null
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | camera = android.hardware.Camera@315589824 (0x12cf84c0)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | characterSet = null
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | decodeFormats = null
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | handler = null
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | hasSurface = false
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | inactivityTimer = com.dkaishu.zxinglib.decoding.InactivityTimer@317701544 (0x12efbda8)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mediaPlayer = android.media.MediaPlayer@317676928 (0x12ef5d80)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | playBeep = true
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | surfaceHolder = android.view.SurfaceView$4@317664496 (0x12ef2cf0)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | surfaceView = android.view.SurfaceView@317794304 (0x12f12800)
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | vibrate = true
03-13 10:28:55.518 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | viewfinderView = com.dkaishu.zxinglib.view.ViewfinderView@317833840 (0x12f1c270)
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mAdded = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mAnimationInfo = null
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mArguments = android.os.Bundle@317701088 (0x12efbbe0)
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mBackStackNesting = 0
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mCalled = true
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mCheckedForLoaderManager = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mChildFragmentManager = null
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mChildNonConfig = null
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mContainer = null
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mContainerId = 0
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mDeferStart = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mDetached = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mFragmentId = 0
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mFragmentManager = null
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mFromLayout = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mHasMenu = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mHidden = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mHiddenChanged = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mHost = null
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mInLayout = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mIndex = -1
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mInnerView = null
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mIsNewlyAdded = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mLoaderManager = null
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mLoadersStarted = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mMenuVisible = true
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mParentFragment = null
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mPerformedCreateView = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mPostponedAlpha = 0.0
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mRemoving = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mRestored = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mRetainInstance = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mRetaining = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mSavedFragmentState = null
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mSavedViewState = null
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mState = 0
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mTag = null
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mTarget = null
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mTargetIndex = -1
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mTargetRequestCode = 0
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mUserVisibleHint = true
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mView = null
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mWho = null
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | shadow$_klass_ = com.dkaishu.zxinglib.activity.CaptureFragment
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | shadow$_monitor_ = 0
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: * Instance of com.dkaishu.zxinglibexample.CustomActivity$2
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static $classOverhead = byte[120]@317450497 (0x12ebe901)
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | this$0 = com.dkaishu.zxinglibexample.CustomActivity@317653344 (0x12ef0160)
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | shadow$_klass_ = com.dkaishu.zxinglibexample.CustomActivity$2
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | shadow$_monitor_ = 0
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: * Instance of com.dkaishu.zxinglibexample.CustomActivity
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | static $classOverhead = byte[3968]@317607937 (0x12ee5001)
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | analyzeCallback = com.dkaishu.zxinglibexample.CustomActivity$2@317419472 (0x12eb6fd0)
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mDelegate = android.support.v7.app.AppCompatDelegateImplN@317534992 (0x12ed3310)
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mEatKeyUpEvent = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mResources = null
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mThemeId = 2131296421
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mCreated = true
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mFragments = android.support.v4.app.FragmentController@317419456 (0x12eb6fc0)
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mHandler = android.support.v4.app.FragmentActivity$1@317584256 (0x12edf380)
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mNextCandidateRequestIndex = 0
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mPendingFragmentActivityResults = android.support.v4.util.SparseArrayCompat@317665800 (0x12ef3208)
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mReallyStopped = true
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mRequestedPermissionsFromFragment = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mResumed = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mRetaining = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mStopped = true
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mStartedActivityFromFragment = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mStartedIntentSenderFromFragment = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mExtraDataMap = android.support.v4.util.SimpleArrayMap@317521656 (0x12ecfef8)
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mActionBar = null
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mActionModeTypeStarting = 0
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mActivityInfo = android.content.pm.ActivityInfo@317534848 (0x12ed3280)
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mActivityTransitionState = android.app.ActivityTransitionState@317422272 (0x12eb7ac0)
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mApplication = com.dkaishu.zxinglibexample.MApplication@315687360 (0x12d101c0)
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mCalled = true
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mChangeCanvasToTranslucent = false
03-13 10:28:55.519 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mChangingConfigurations = false
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mCheckForDragging = false
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mComponent = android.content.ComponentName@317624400 (0x12ee9050)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mConfigChangeFlags = 0
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mCurrentConfig = android.content.res.Configuration@317401368 (0x12eb2918)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mDecor = null
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mDefaultKeyMode = 0
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mDefaultKeySsb = null
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mDestroyed = true
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mDoReportFullyDrawn = false
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mDragging = false
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mEatKeyUpEvent = false
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mEmbeddedID = null
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mEnableDefaultActionBarUp = false
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mEnterTransitionListener = android.app.SharedElementCallback$1@1894320480 (0x70e90960)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mExitTransitionListener = android.app.SharedElementCallback$1@1894320480 (0x70e90960)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mFinished = true
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mFragments = android.app.FragmentController@317419408 (0x12eb6f90)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mHandler = android.os.Handler@317584192 (0x12edf340)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mHasCurrentPermissionsRequest = false
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mIdent = 91416045
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mInstanceTracker = android.os.StrictMode$InstanceTracker@317419424 (0x12eb6fa0)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mInstrumentation = android.app.Instrumentation@315486136 (0x12cdefb8)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mIntent = android.content.Intent@317620432 (0x12ee80d0)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mInterceptor = miui.contentcatcher.InterceptorProxy@317661648 (0x12ef21d0)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mIsInPictureInPictureMode = false
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mLastDraging = false
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mLastNonConfigurationInstances = null
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mMainThread = android.app.ActivityThread@315548160 (0x12cee200)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mManagedCursors = java.util.ArrayList@317521608 (0x12ecfec8)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mManagedDialogs = null
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mMenuInflater = null
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mParent = null
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mReferrer = java.lang.String@317621008 (0x12ee8310)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mResultCode = 0
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mResultData = null
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mResumed = false
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mSearchEvent = null
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mSearchManager = null
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mStartedActivity = false
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mStopped = true
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mTaskDescription = android.app.ActivityManager$TaskDescription@317584224 (0x12edf360)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mTemporaryPause = false
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mTitle = java.lang.String@316419472 (0x12dc2d90)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mTitleColor = 0
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mTitleReady = true
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mToken = android.os.BinderProxy@317554848 (0x12ed80a0)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mTouchDownX = 0
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mTouchDownY = 0
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mTranslucentCallback = null
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mUiThread = java.lang.Thread@2015109120 (0x781c2000)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mVisibleBehind = false
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mVisibleFromClient = true
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mVisibleFromServer = true
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mVoiceInteractor = null
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mWindow = com.android.internal.policy.MiuiPhoneWindow@316792096 (0x12e1dd20)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mWindowAdded = true
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mWindowManager = android.view.WindowManagerImpl@317665608 (0x12ef3148)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mInflater = com.android.internal.policy.PhoneLayoutInflater@317430128 (0x12eb9970)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mOverrideConfiguration = null
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mResources = android.content.res.MiuiResources@317429984 (0x12eb98e0)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mTheme = android.content.res.Resources$Theme@317661440 (0x12ef2100)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mThemeResource = 2131296421
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | mBase = android.app.ContextImpl@317282784 (0x12e959e0)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | shadow$_klass_ = com.dkaishu.zxinglibexample.CustomActivity
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | shadow$_monitor_ = 1073760436
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: * Excluded Refs:
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | Field: android.widget.Editor$Blink.this$0
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | Field: android.view.Choreographer$FrameDisplayEventReceiver.mMessageQueue (always)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | Thread:FinalizerWatchdogDaemon (always)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | Thread:main (always)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | Thread:LeakCanary-Heap-Dump (always)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | Class:java.lang.ref.WeakReference (always)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | Class:java.lang.ref.SoftReference (always)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | Class:java.lang.ref.PhantomReference (always)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | Class:java.lang.ref.Finalizer (always)
03-13 10:28:55.520 13871-16396/com.dkaishu.zxinglibexample D/LeakCanary: | Class:java.lang.ref.FinalizerReference (always)
03-13 10:29:00.237 13871-13894/com.dkaishu.zxinglibexample D/LeakCanary: Could not dump heap, previous analysis still is in progress.
there are many ways to fix,And i had fixed it in CaptureActivity by :
@Override
public void onDestroy() {
super.onDestroy();
inactivityTimer.shutdown();
if (mediaPlayer != null) {
mediaPlayer.stop();
mediaPlayer.release();
mediaPlayer = null;
}
}
pealse update to V1.0.6
I hope this can hlep you .
references com.dkaishu.zxinglib.decoding.InactivityTimer.activity