如何修复广告视图中的泄漏内存(泄漏金丝雀日志)?

时间:2015-12-22 07:59:58

标签: android memory-leaks leakcanary

leak canary log 

* LEAK CAN BE IGNORED.
* com.google.android.gms.ads.AdActivity has leaked:
* GC ROOT static android.view.inputmethod.InputMethodManager.sInstance
* references android.view.inputmethod.InputMethodManager.mCurRootView
* references com.android.internal.policy.impl.PhoneWindow$DecorView.mConte
* leaks com.google.android.gms.ads.AdActivity instance
* Reference Key: 1d99cee7-413e-4f3c-866e-c667a96437e4
* Device: LGE lge LG-D295 l70pds_global_com
* Android Version: 4.4.2 API: 19 LeakCanary: 1.3.1
* Durations: watch=5009ms, gc=138ms, heap dump=831ms, analysis=19366ms
* Details:
* Class android.view.inputmethod.InputMethodManager
|   static $staticOverhead = byte[] [id=0x41761009;length=696;size=712]
|   static CONTROL_START_INITIAL = 256
|   static CONTROL_WINDOW_FIRST = 4
|   static CONTROL_WINDOW_IS_TEXT_EDITOR = 2
|   static CONTROL_WINDOW_VIEW_HAS_FOCUS = 1
|   static DEBUG = false
|   static DISPATCH_HANDLED = 1
|   static DISPATCH_IN_PROGRESS = -1
|   static DISPATCH_NOT_HANDLED = 0
|   static HIDE_IMPLICIT_ONLY = 1
|   static HIDE_NOT_ALWAYS = 2
|   static INPUT_METHOD_NOT_RESPONDING_TIMEOUT = 2500
|   static MSG_BIND = 2
|   static MSG_DUMP = 1
|   static MSG_FLUSH_INPUT_EVENT = 7
|   static MSG_SCREEN_ON_OFF = 8
|   static MSG_SEND_INPUT_EVENT = 5
|   static MSG_SET_ACTIVE = 4
|   static MSG_SHOW_SOFT_INPUT = 9
|   static MSG_TIMEOUT_INPUT_EVENT = 6
|   static MSG_UNBIND = 3
|   static PENDING_EVENT_COUNTER = java.lang.String [id=0x4184bfd0]
|   static RESULT_HIDDEN = 3
|   static RESULT_SHOWN = 2
|   static RESULT_UNCHANGED_HIDDEN = 1
|   static RESULT_UNCHANGED_SHOWN = 0
|   static SHOW_FORCED = 2
|   static SHOW_IMPLICIT = 1
|   static TAG = java.lang.String [id=0x4184c010]
|   static sInstance = android.view.inputmethod.InputMethodManager [id=0x4
* Instance of android.view.inputmethod.InputMethodManager
|   static $staticOverhead = byte[] [id=0x41761009;length=696;size=712]
|   static CONTROL_START_INITIAL = 256
|   static CONTROL_WINDOW_FIRST = 4
|   static CONTROL_WINDOW_IS_TEXT_EDITOR = 2
|   static CONTROL_WINDOW_VIEW_HAS_FOCUS = 1
|   static DEBUG = false
|   static DISPATCH_HANDLED = 1
|   static DISPATCH_IN_PROGRESS = -1
|   static DISPATCH_NOT_HANDLED = 0
|   static HIDE_IMPLICIT_ONLY = 1
|   static HIDE_NOT_ALWAYS = 2
|   static INPUT_METHOD_NOT_RESPONDING_TIMEOUT = 2500
|   static MSG_BIND = 2
|   static MSG_DUMP = 1
|   static MSG_FLUSH_INPUT_EVENT = 7
|   static MSG_SCREEN_ON_OFF = 8
|   static MSG_SEND_INPUT_EVENT = 5
|   static MSG_SET_ACTIVE = 4
|   static MSG_SHOW_SOFT_INPUT = 9
|   static MSG_TIMEOUT_INPUT_EVENT = 6
|   static MSG_UNBIND = 3
|   static PENDING_EVENT_COUNTER = java.lang.String [id=0x4184bfd0]
|   static RESULT_HIDDEN = 3
|   static RESULT_SHOWN = 2
|   static RESULT_UNCHANGED_HIDDEN = 1
|   static RESULT_UNCHANGED_SHOWN = 0
|   static SHOW_FORCED = 2
|   static SHOW_IMPLICIT = 1
|   static TAG = java.lang.String [id=0x4184c010]
|   static sInstance = android.view.inputmethod.InputMethodManager [id=0x4
|   mTmpCursorRect = android.graphics.Rect [id=0x41f6b540]
|   mService = com.android.internal.view.IInputMethodManager$Stub$Proxy [i
|   mClient = android.view.inputmethod.InputMethodManager$1 [id=0x41f6b730
|   mCompletions = null
|   mCurChannel = null
|   mCurId = null
|   mCurMethod = null
|   mCurRootView = com.android.internal.policy.impl.PhoneWindow$DecorView 
|   mCurSender = null
|   mCurrentTextBoxAttribute = null
|   mServedView = com.google.android.gms.ads.internal.u.k [id=0x41e85648]
|   mServedInputConnectionWrapper = null
|   mCursorRect = android.graphics.Rect [id=0x41f6b560]
|   mServedInputConnection = null
|   mPendingEvents = android.util.SparseArray [id=0x41f6b600]
|   mDummyInputConnection = android.view.inputmethod.BaseInputConnection [
|   mPendingEventPool = android.util.Pools$SimplePool [id=0x41f6b580]
|   mH = android.view.inputmethod.InputMethodManager$H [id=0x41f6b7a0]
|   mNextServedView = com.google.android.gms.ads.internal.u.k [id=0x41e856
|   mIInputContext = android.view.inputmethod.InputMethodManager$Controlle
|   mMainLooper = android.os.Looper [id=0x41dc8ce0]
|   mHasBeenInactive = true
|   mFullscreenMode = false
|   mCursorSelStart = 0
|   mServedConnecting = false
|   mCursorSelEnd = 0
|   mCursorCandStart = -1
|   mCursorCandEnd = -1
|   mBindSequence = -1
|   mSoftInputMode = 272
|   mActive = false
* Instance of com.android.internal.policy.impl.PhoneWindow$DecorView
|   mActionMode = null
|   mActionModePopup = null
|   mActionModeView = null
|   mBackgroundPadding = android.graphics.Rect [id=0x41e6ee20]
|   this$0 = com.android.internal.policy.impl.PhoneWindowEx [id=0x41e6cbf0
|   mStatusGuard = null
|   mShowActionModePopup = null
|   mDrawingBounds = android.graphics.Rect [id=0x41e6ee00]
|   mNavigationGuard = null
|   mFrameOffsets = android.graphics.Rect [id=0x41e74728]
|   mFramePadding = android.graphics.Rect [id=0x41e74708]
|   mMenuBackground = null
|   mFeatureId = -1
|   mDownY = 0
|   mDefaultOpacity = -2
|   mWatchingForMenu = false
|   mChanging = false
|   mForeground = null
|   mSelfBounds = android.graphics.Rect [id=0x41e6ed90]
|   mOverlayBounds = android.graphics.Rect [id=0x41e6edb0]
|   mMatchParentChildren = java.util.ArrayList [id=0x41e6edd0]
|   mForegroundPaddingBottom = 0
|   mForegroundPaddingLeft = 0
|   mForegroundPaddingRight = 0
|   mForegroundPaddingTop = 0
|   mForegroundInPadding = true
|   mMeasureAllChildren = false
|   mForegroundGravity = 119
|   mForegroundBoundsChanged = true
|   mAnimationListener = null
|   mCachePaint = null
|   mVisibilityChangingChildren = null
|   mTransitioningViews = null
|   mChildTransformation = null
|   mChildren = android.view.View[] [id=0x41e6ed48;length=12]
|   mTransition = null
|   mCurrentDrag = null
|   mCurrentDragView = null
|   mDisappearingChildren = null
|   mDragNotifiedChildren = null
|   mFirstHoverTarget = null
|   mFirstTouchTarget = null
|   mFocused = null
|   mOnHierarchyChangeListener = null
|   mLocalPoint = null
|   mInvalidateRegion = null
|   mInvalidationTransformation = null
|   mLayoutTransitionListener = android.view.ViewGroup$3 [id=0x420e2b30]
|   mLayoutAnimationController = null
|   mLastTouchDownTime = 0
|   mLastTouchDownY = 0.0
|   mLastTouchDownX = 0.0
|   mLayoutCalledWhileSuppressed = false
|   mLayoutMode = -1
|   mLastTouchDownIndex = -1
|   mHoveredSelf = false
|   mGroupFlags = 2375763
|   mPersistentDrawingCache = 2
|   mSuppressLayout = false
|   mChildrenCount = 1
|   mChildCountWithTransientState = 0
|   mChildAcceptsDrag = false
|   mUnsetPressedState = null
|   mAccessibilityDelegate = null
|   mUnscaledDrawingCache = null
|   mAnimator = null
|   mAttachInfo = null
|   mBackground = android.graphics.drawable.ColorDrawable [id=0x41ef0ae8]
|   mTransformationInfo = null
|   mTouchDelegate = null
|   mTag = null
|   mSendViewStateChangedAccessibilityEvent = null
|   mClipBounds = null
|   mContentDescription = null
|   mContext = com.google.android.gms.ads.AdActivity [id=0x41dd05c0]
|   mCurrentAnimation = null
|   mDisplayList = android.view.GLES20DisplayList [id=0x41ed2dc0]
|   mDrawableState = null
|   mDrawingCache = null
|   mSendViewScrolledAccessibilityEvent = null
|   mFloatingTreeObserver = null
|   mHardwareLayer = null
|   mScrollCache = null
|   mResources = android.content.res.XResources [id=0x41dd0208]
|   mInputEventConsistencyVerifier = null
|   mKeyedTags = null
|   mPerformClick = null
|   mPendingCheckForTap = null
|   mLayerPaint = null
|   mPendingCheckForLongPress = null
|   mLayoutInsets = null
|   mLayoutParams = android.view.WindowManager$LayoutParams [id=0x41dee718
|   mParent = null
|   mOverlay = null
|   mListenerInfo = null
|   mLocalDirtyRect = null
|   mMeasureCache = android.util.LongSparseLongArray [id=0x41f5b398]
|   mMatchIdPredicate = null
|   mMatchLabelForPredicate = null
|   mLongPressTimeout = 0
|   mMeasuredHeight = 734
|   mMeasuredWidth = 480
|   mMinHeight = 0
|   mMinWidth = 0
|   mNextFocusDownId = -1
|   mNextFocusForwardId = -1
|   mNextFocusLeftId = -1
|   mNextFocusRightId = -1
|   mNextFocusUpId = -1
|   mOldHeightMeasureSpec = 1073742558
|   mOldWidthMeasureSpec = 1073742304
|   mOnTapTimeout = false
|   mOverScrollMode = 1
|   mLeftPaddingDefined = true
|   mPaddingBottom = 0
|   mPaddingLeft = 0
|   mPaddingRight = 0
|   mPaddingTop = 0
|   mLeft = 0
|   mLayerType = 0
|   mLastIsOpaque = false
|   mLabelForId = -1
|   mPrivateFlags = 18877752
|   mPrivateFlags2 = 1611867680
|   mPrivateFlags3 = 0
|   mRecreateDisplayList = false
|   mID = -1
|   mRight = 480
|   mRightPaddingDefined = true
|   mHasPerformedLongPress = false
|   mScrollX = 0
|   mScrollY = 0
|   mDrawingCacheBackgroundColor = 0
|   mCachingFailed = false
|   mSendingHoverAccessibilityEvents = false
|   mSystemUiVisibility = 0
|   mBottom = 734
|   mTapTimeout = 0
|   mTop = 0
|   mBackgroundSizeChanged = false
|   mTouchSlop = 20
|   mBackgroundResource = 0
|   mTransientStateCount = 0
|   mAccessibilityViewId = -1
|   mAccessibilityCursorPosition = -1
|   mUserPaddingBottom = 0
|   mUserPaddingEnd = -2147483648
|   mUserPaddingLeft = 0
|   mUserPaddingLeftInitial = 0
|   mUserPaddingRight = 0
|   mUserPaddingRightInitial = 0
|   mUserPaddingStart = -2147483648
|   mVerticalScrollFactor = 0.0
|   mVerticalScrollbarPosition = 0
|   mViewFlags = 402655360
|   mWindowAttachCount = 1
* Instance of com.google.android.gms.ads.AdActivity
|   static $staticOverhead = byte[] [id=0x41f1f8d9;length=48;size=64]
|   static CLASS_NAME = java.lang.String [id=0x41eb9f10]
|   static SIMPLE_CLASS_NAME = java.lang.String [id=0x41f1fa30]
|   zznK = com.google.android.gms.internal.zzfk$zza$zza [id=0x41dc4b28]
|   mActionBar = null
|   mActivityInfo = android.content.pm.ActivityInfo [id=0x42049050]
|   mAllLoaderManagers = android.util.ArrayMap [id=0x41e61b40]
|   mApplication = com.teen_message.Dictionary [id=0x41dd1918]
|   viewAgent = null
|   mWindowManager = android.view.WindowManagerImpl [id=0x41e00900]
|   mWindow = com.android.internal.policy.impl.PhoneWindowEx [id=0x41e6cbf
|   mUiThread = java.lang.Thread [id=0x4172af90]
|   mComponent = android.content.ComponentName [id=0x41eaca78]
|   mTranslucentCallback = null
|   mContainer = android.app.Activity$1 [id=0x41df1508]
|   mCurrentConfig = android.content.res.Configuration [id=0x41df0cf8]
|   mDecor = null
|   mToken = android.os.BinderProxy [id=0x420e2968]
|   mDefaultKeySsb = null
|   mTitle = java.lang.String [id=0x41e97ee0]
|   mSearchManager = null
|   mEmbeddedID = null
|   mResultData = null
|   mParent = null
|   mFragments = android.app.FragmentManagerImpl [id=0x41e84c00]
|   mHandler = android.os.Handler [id=0x41e84c90]
|   mMenuInflater = null
|   mInstanceTracker = android.os.StrictMode$InstanceTracker [id=0x41df0eb
|   mInstrumentation = android.app.Instrumentation [id=0x41dd14c0]
|   mIntent = android.content.Intent [id=0x420e28d8]
|   mLastNonConfigurationInstances = null
|   mLoaderManager = null
|   mManagedDialogs = null
|   mMainThread = android.app.ActivityThread [id=0x41dc8d68]
|   mManagedCursors = java.util.ArrayList [id=0x41e02ca0]
|   mLoadersStarted = false
|   mIdent = 1105418136
|   mFinished = true
|   mResultCode = 0
|   mEnableDefaultActionBarUp = false
|   mResumed = false
|   mDoReportFullyDrawn = false
|   mStartedActivity = false
|   mStopped = true
|   mTemporaryPause = false
|   mDestroyed = true
|   mTitleColor = 0
|   mTitleReady = true
|   mDefaultKeyMode = 0
|   mConfigChangeFlags = 0
|   mCheckedForLoaderManager = true
|   mVisibleFromClient = true
|   mVisibleFromServer = true
|   mChangingConfigurations = false
|   mWindowAdded = true
|   mChangeCanvasToTranslucent = false
|   mCalled = true
|   mBase = android.app.ContextImpl [id=0x41e84440]
|   mInflater = com.android.internal.policy.impl.PhoneLayoutInflater [id=0
|   mOverrideConfiguration = null
|   mResources = android.content.res.XResources [id=0x41dd0208]
|   mTheme = android.content.res.Resources$Theme [id=0x41e00870]
|   mThemeResource = 16973839
|   mBase = android.app.ContextImpl [id=0x41e84440]`

请帮我解决这个漏洞

1 个答案:

答案 0 :(得分:0)

在销毁活动期间,将广告视图设置为null。如果这不起作用,请从其父容器中删除该广告。