Memory leak in Webview
Reported by
himgupta...@gmail.com,
Jun 28 2018
|
||
Issue descriptionSteps to reproduce the problem: 1. Open activity with webview ,do something and close the activity. What is the expected behavior? No memory leak should occur What went wrong? Memory leak occurs in Did this work before? N/A Chrome version: 67.0.3396.87 Channel: n/a OS Version: 4.4.2 Flash Version: * com.***.CBActivity has leaked: * GC ROOT android.os.ResultReceiver$MyResultReceiver.this$0 * references com.android.org.chromium.content.browser.ContentViewCore$3$1.this$1 (anonymous subclass of android.os.ResultReceiver) * references com.android.org.chromium.content.browser.ContentViewCore$3.this$0 (anonymous implementation of com.android.org.chromium.content.browser.input.ImeAdapter$ImeAdapterDelegate) * references com.android.org.chromium.content.browser.ContentViewCore.mContext * leaks com.***.CBActivity instance * Retaining: 128KB. * Reference Key: 26e91c53-09a6-4175-aa72-11a1166fad83 * Device: LGE google Nexus 4 occam * Android Version: 4.4.2 API: 19 LeakCanary: 1.5.4 74837f0 * Durations: watch=36055ms, gc=184ms, heap dump=647ms, analysis=30499ms * Details: * Instance of android.os.ResultReceiver$MyResultReceiver | this$0 = com.android.org.chromium.content.browser.ContentViewCore$3$1@1108423840 (0x421134a0) | mDescriptor = java.lang.String@1107986528 (0x420a8860) | mOwner = android.os.ResultReceiver$MyResultReceiver@1108423904 (0x421134e0) | mObject = 2013365896 * Instance of com.android.org.chromium.content.browser.ContentViewCore$3$1 | this$1 = com.android.org.chromium.content.browser.ContentViewCore$3@1108007256 (0x420ad958) | mHandler = android.os.Handler@1108423872 (0x421134c0) | mReceiver = android.os.ResultReceiver$MyResultReceiver@1108423904 (0x421134e0) | mLocal = true * Instance of com.android.org.chromium.content.browser.ContentViewCore$3 | this$0 = com.android.org.chromium.content.browser.ContentViewCore@1109188056 (0x421cddd8) * Instance of com.android.org.chromium.content.browser.ContentViewCore | static $staticOverhead = byte[24]@1097373529 (0x41689759) | static $assertionsDisabled = true | mAccessibilityInjector = com.android.org.chromium.content.browser.accessibility.JellyBeanAccessibilityInjector@1109310704 (0x421ebcf0) | mAccessibilityManager = android.view.accessibility.AccessibilityManager@1105423840 (0x41e36de0) | mAccessibilityScriptInjectionObserver = null | mActionMode = null | mAdapterInputConnectionFactory = com.android.org.chromium.content.browser.input.ImeAdapter$AdapterInputConnectionFactory@1107164400 (0x41fdfcf0) | mZoomManager = com.android.org.chromium.content.browser.ZoomManager@1109093592 (0x421b6cd8) | mBrowserAccessibilityManager = null | mContainerView = android.webkit.WebView@1109251552 (0x421dd5e0) | mContainerViewInternals = com.android.webview.chromium.WebViewChromium$InternalAccessAdapter@1109459208 (0x42210108) | mContentSettings = null | mContentViewClient = com.android.org.chromium.android_webview.AwContentsClient$AwContentViewClient@1107173736 (0x41fe2168) | mContentViewGestureHandler = com.android.org.chromium.content.browser.ContentViewGestureHandler@1109273664 (0x421e2c40) | mContext = com.***.CBActivity@1109414440 (0x42205228) | mDeferredHandleFadeInRunnable = null | mZoomControlsDelegate = com.android.org.chromium.android_webview.AwZoomControls@1108733792 (0x4215ef60) | mDownloadDelegate = null | mEndHandlePoint = com.android.org.chromium.content.browser.RenderCoordinates$NormalizedPoint@1109056336 (0x421adb50) | mFakeMouseMoveRunnable = null | mFocusPreOSKViewportRect = android.graphics.Rect@1109189896 (0x421ce508) | mGestureStateListener = com.android.org.chromium.android_webview.AwContents$AwGestureStateListener@1106566400 (0x41f4dd00) | mWebContentsObserver = com.android.org.chromium.content.browser.ContentViewCore$5@1109486728 (0x42216c88) | mViewAndroid = com.android.org.chromium.ui.ViewAndroid@1109076008 (0x421b2828) | mImeAdapter = com.android.org.chromium.content.browser.input.ImeAdapter@1109309856 (0x421eb9a0) | mInputConnection = com.android.org.chromium.content.browser.input.AdapterInputConnection@1109376256 (0x421fbd00) | mInsertionHandleController = com.android.org.chromium.content.browser.ContentViewCore$13@1105745576 (0x41e856a8) | mInsertionHandlePoint = com.android.org.chromium.content.browser.RenderCoordinates$NormalizedPoint@1109056360 (0x421adb68) | mJavaScriptInterfaces = java.util.HashMap@1109188344 (0x421cdef8) | mLastSelectedText = java.lang.String@1109000048 (0x4219ff70) | mVSyncProvider = null | mVSyncListener = null | mStartHandlePoint = com.android.org.chromium.content.browser.RenderCoordinates$NormalizedPoint@1109056312 (0x421adb38) | mSelectionHandleController = null | mRetainedJavaScriptObjects = java.util.HashSet@1107093512 (0x41fce808) | mRenderCoordinates = com.android.org.chromium.content.browser.RenderCoordinates@1109056256 (0x421adb00) | mPositionObserver = com.android.org.chromium.content.browser.ViewPositionObserver@1109073720 (0x421b1f38) | mPositionListener = com.android.org.chromium.content.browser.ContentViewCore$4@1107295752 (0x41fffe08) | mPopupZoomer = com.android.org.chromium.content.browser.PopupZoomer@1109280640 (0x421e4780) | mPid = 6961 | mPhysicalBackingWidthPix = 768 | mPhysicalBackingHeightPix = 1134 | mPendingRendererFrame = true | mOverdrawBottomHeightPix = 0 | mNeedUpdateOrientationChanged = false | mScrolledAndZoomedFocusedEditableNode = false | mSelectionEditable = false | mNeedAnimate = false | mNativeContentViewCore = 0 | mUnfocusOnNextSizeChanged = false | mUnselectAllOnActionModeDismiss = false | mNativeAccessibilityEnabled = false | mVSyncListenerRegistered = false | mNativeAccessibilityAllowed = false | mVSyncSubscriberCount = 0 | mHasSelection = false | mViewportHeightPix = 1134 | mViewportSizeOffsetHeightPix = 0 | mViewportSizeOffsetWidthPix = 0 | mViewportWidthPix = 768 | mHardwareAccelerated = true | mDidSignalVSyncUsingInputEvent = false | mAttachedToWindow = false * Instance of com.***.CBActivity | static $staticOverhead = byte[72]@1107093577 (0x41fce849) | static e = null | static b = 3 | static a = null | c = com.***.bean.CustomBrowserConfig@1109447040 (0x4220d180) | d = com.***.util.CBUtil@1109446640 (0x4220cff0) | f = com.***.Bank@1109444744 (0x4220c888) | g = null | h = null | mDelegate = android.support.v7.app.AppCompatDelegateImplV14@1109417984 (0x42206000) | mResources = null | mThemeId = 2131230870 | mViewModelStore = null | mFragments = android.support.v4.app.FragmentController@1109415656 (0x422056e8) | mHandler = android.support.v4.app.FragmentActivity$1@1109415392 (0x422055e0) | mLoaderManager = null | mPendingFragmentActivityResults = android.support.v4.util.SparseArrayCompat@1109420824 (0x42206b18) | mNextCandidateRequestIndex = 0 | mReallyStopped = true | mRequestedPermissionsFromFragment = false | mResumed = false | mRetaining = false | mStopped = true | mCreated = true | mStartedActivityFromFragment = false | mStartedIntentSenderFromFragment = false | mExtraDataMap = android.support.v4.util.SimpleArrayMap@1109415032 (0x42205478) | mLifecycleRegistry = android.arch.lifecycle.LifecycleRegistry@1109415056 (0x42205490) | mActionBar = null | mActivityInfo = android.content.pm.ActivityInfo@1109412432 (0x42204a50) | mAllLoaderManagers = android.util.ArrayMap@1109451936 (0x4220e4a0) | mApplication = com.payu.testapp.CustomApp@1105131776 (0x41def900) | mWindowManager = android.view.WindowManagerImpl@1109417832 (0x42205f68) | mWindow = com.android.internal.policy.impl.PhoneWindow@1109416320 (0x42205980) | mUiThread = java.lang.Thread@1095912616 (0x41524ca8) | mTranslucentCallback = null | mComponent = android.content.ComponentName@1109412152 (0x42204938) | mToken = android.os.BinderProxy@1109412336 (0x422049f0) | mContainer = android.app.Activity$1@1109414904 (0x422053f8) | mCurrentConfig = android.content.res.Configuration@1109416184 (0x422058f8) | mDecor = null | mTitle = java.lang.String@1105334744 (0x41e211d8) | mDefaultKeySsb = null | mSearchManager = null | mResultData = null | mEmbeddedID = null | mParent = null | mMenuInflater = null | mFragments = android.app.FragmentManagerImpl@1109414784 (0x42205380) | mHandler = android.os.Handler@1109415000 (0x42205458) | mManagedDialogs = null | mInstanceTracker = android.os.StrictMode$InstanceTracker@1109414944 (0x42205420) | mInstrumentation = android.app.Instrumentation@1105127520 (0x41dee860) | mIntent = android.content.Intent@1109412008 (0x422048a8) | mLastNonConfigurationInstances = null | mLoaderManager = null | mManagedCursors = java.util.ArrayList@1109414920 (0x42205408) | mMainThread = android.app.ActivityThread@1105107096 (0x41de9898) | mLoadersStarted = false | mIdent = 1112835304 | mFinished = true | mEnableDefaultActionBarUp = false | mResultCode = 0 | mDoReportFullyDrawn = false | mResumed = false | mDestroyed = true | mStartedActivity = false | mStopped = true | mTemporaryPause = false | mDefaultKeyMode = 0 | mTitleColor = 0 | mTitleReady = true | mConfigChangeFlags = 0 | mCheckedForLoaderManager = true | mChangingConfigurations = false | mVisibleFromClient = true | mVisibleFromServer = true | mChangeCanvasToTranslucent = false | mWindowAdded = true | mCalled = true | mBase = android.app.ContextImpl@1109415672 (0x422056f8) | mInflater = com.android.internal.policy.impl.PhoneLayoutInflater@1109417424 (0x42205dd0) | mOverrideConfiguration = null | mResources = android.content.res.Resources@1105124264 (0x41dedba8) | mTheme = android.content.res.Resources$Theme@1109417856 (0x42205f80) | mThemeResource = 2131230870 | mBase = android.app.ContextImpl@1109415672 (0x422056f8) * Excluded Refs: | Field: android.app.ActivityThread$ActivityClientRecord.nextIdle | Field: android.widget.Editor$EasyEditSpanController.this$0 | Field: android.widget.Editor$SpanController.this$0 | Field: android.os.Message.obj | Field: android.os.Message.next | Field: android.os.Message.target | Field: android.view.inputmethod.InputMethodManager.mNextServedView | Field: android.view.inputmethod.InputMethodManager.mServedView | Field: android.view.inputmethod.InputMethodManager.mServedInputConnection | Field: android.view.inputmethod.InputMethodManager.mCurRootView | Field: android.animation.LayoutTransition$1.val$parent | Field: android.view.textservice.SpellCheckerSession$1.this$0 | Field: android.support.v7.internal.widget.ActivityChooserModel.mActivityChoserModelPolicy | Field: android.widget.ActivityChooserModel.mActivityChoserModelPolicy | Field: android.speech.SpeechRecognizer$InternalListener.this$0 | Field: android.accounts.AccountManager$AmsTask$Response.this$1 | Field: android.media.MediaScannerConnection.mContext | Field: android.os.UserManager.mContext | Field: android.appwidget.AppWidgetHost$Callbacks.this$0 | Field: android.media.AudioManager$1.this$0 | Field: android.widget.Editor$Blink.this$0 | Field: android.net.ConnectivityManager.sInstance | Field: android.view.Choreographer$FrameDisplayEventReceiver.mMessageQueue (always) | Static field: android.text.TextLine.sCached | Static field: android.widget.BubblePopupHelper.sHelper | Thread:FinalizerWatchdogDaemon (always) | Thread:main (always) | Thread:LeakCanary-Heap-Dump (always) | Class:java.lang.ref.WeakReference (always) | Class:java.lang.ref.SoftReference (always) | Class:java.lang.ref.PhantomReference (always) | Class:java.lang.ref.Finalizer (always) | Class:java.lang.ref.FinalizerReference (always)
,
Jun 28 2018
WebView is not updatable on Android 4.4 so we can't do anything about this, unfortunately. Make sure that your Activity.onDestroy method removes the WebView from the view hierarchy and then calls WebView.destroy() - this usually works around this type of issue on old versions. |
||
►
Sign in to add a comment |
||
Comment 1 by dtapu...@chromium.org
, Jun 28 2018