小立子的世界 2017-02-09 23:26 采纳率: 0%
浏览 3277

EMUI5.0 Android7.0中开发遇到内存泄漏

com.zxsd.shoppingguide.activity.AggregationEntryActivity has leaked:
GC ROOT static android.gestureboost.GestureBoostManager.sGestureBoostManager
references android.gestureboost.GestureBoostManager.mContext
leaks com.zxsd.shoppingguide.activity.AggregationEntryActivity instance
Retaining: 4.9 KB.
Reference Key: def072d8-5909-4709-9365-9a244a488e02
Device: HUAWEI honor FRD-AL10 FRD-AL10
Android Version: 7.0 API: 24 LeakCanary: 1.5 00f37f5
Durations: watch=5011ms, gc=173ms, heap dump=1862ms, analysis=103468ms
Details:
Class android.gestureboost.GestureBoostManager
static sGestureBoostManager = android.gestureboost.GestureBoostManager@3172306 (0x12e88e50)
static SWITCH_GESTURE_BOOST = 4
static $classOverhead = byte[652]@318563329 (0x12fce401)
static TAG = java.lang.String@1896298 (0x71073638)
static GESTURE_BOOST_CODE = 10001
static RMS_EXT_CODE_BASE = 10000
Instance of android.gestureboost.GestureBoostManager
static sGestureBoostManager = android.gestureboost.GestureBoostManager@3172306 (0x12e88e50)
static SWITCH_GESTURE_BOOST = 4
static $classOverhead = byte[652]@318563329 (0x12fce401)
static TAG = java.lang.String@1896298 (0x71073638)
static GESTURE_BOOST_CODE = 10001
static RMS_EXT_CODE_BASE = 10000
mAwareService = null
mContext = com.zxsd.shoppingguide.activity.AggregationEntryActivity@3151232 (0x12c86600)
mGestureBoostflag = false
shadow$klass = android.gestureboost.GestureBoostManager
shadow$monitor = 0
Instance of com.zxsd.shoppingguide.activity.AggregationEntryActivity
static $change = null
static $classOverhead = byte[4544]@316317697 (0x12daa001)
static serialVersionUID = 0
appBarLayout = android.support.design.widget.AppBarLayout@3208130 (0x131f3800)
btnLeft = android.support.v7.widget.AppCompatTextView@3211796 (0x1324d000)
btnRight = android.support.v7.widget.AppCompatTextView@3212390 (0x1325b800)
btnRightTwo = android.support.v7.widget.AppCompatTextView@3212267 (0x13258800)
bundle = android.os.Bundle@3205945 (0x131be280)
container = android.widget.FrameLayout@3214438 (0x1328d800)
fragment = com.zxsd.shoppingguide.fragment.AggregationEntryFragment@3151228 (0x12c864c0)
imgBack = android.support.v7.widget.AppCompatImageButton@3211827 (0x1324dc00)
imgMore = android.support.v7.widget.AppCompatImageButton@3212369 (0x1325b000)
layoutId = 2130968603
toolbar = android.support.v7.widget.Toolbar@3211560 (0x13247400)
toolbarTitle = android.support.v7.widget.AppCompatTextView@3214479 (0x1328e800)
mDelegate = android.support.v7.app.AppCompatDelegateImplN@3148888 (0x12c4d280)
mEatKeyUpEvent = false
mResources = null
mThemeId = 2131361857
mCreated = true
mFragments = android.support.v4.app.FragmentController@3164159 (0x12dc1fc0)
mHandler = android.support.v4.app.FragmentActivity$1@319517120 (0x130b71c0)
mNextCandidateRequestIndex = 0
mOptionsMenuInvalidated = false
mPendingFragmentActivityResults = android.support.v4.util.SparseArrayCompat@3205947 (0x131be340)
mReallyStopped = true
mRequestedPermissionsFromFragment = false
mResumed = false
mRetaining = false
mStopped = true
mStartedActivityFromFragment = false
mStartedIntentSenderFromFragment = false
mExtraDataMap = android.support.v4.util.SimpleArrayMap@3204282 (0x131958c8)
mActionBar = null
mActionModeTypeStarting = 0
mActivityInfo = android.content.pm.ActivityInfo@3148902 (0x12c4d820)
mActivityTransitionState = android.app.ActivityTransitionState@3191331 (0x130595b8)
mApplication = com.zxsd.shoppingguide.base.App@3146104 (0x12c09308)
mCalled = true
mChangeCanvasToTranslucent = false
mChangingConfigurations = false
mComponent = android.content.ComponentName@3162928 (0x12da3f00)
mConfigChangeFlags = 0
mCurrentConfig = android.content.res.Configuration@3158405 (0x12d35848)
mCustActivity = android.app.HwCustActivityImpl@3204282 (0x131958f8)
mDecor = null
mDefaultKeyMode = 0
mDefaultKeySsb = null
mDestroyed = true
mDoReportFullyDrawn = false
mEatKeyUpEvent = false
mEmbeddedID = null
mEnableDefaultActionBarUp = false
mEnterTransitionListener = android.app.SharedElementCallback$1@1903589792 (0x717679a0)
mExitTransitionListener = android.app.SharedElementCallback$1@1903589792 (0x717679a0)
mFinished = true
mFragments = android.app.FragmentController@3153430 (0x12cbc0d0)
mHandler = android.os.Handler@3195173 (0x130b72c0)
mHasCurrentPermissionsRequest = false
mIdent = 132658027
mInstanceTracker = android.os.StrictMode$InstanceTracker@315343040 (0x12cbc0c0)
mInstrumentation = android.app.Instrumentation@3148126 (0x12c3a8f8)
mIntent = android.content.Intent@3168869 (0x12e34fc0)
mIsFullFlag = false
mLastNonConfigurationInstances = null
mMainThread = android.app.ActivityThread@3147206 (0x12c24160)
mManagedCursors = java.util.ArrayList@3204284 (0x131959a0)
mManagedDialogs = null
mMenuInflater = null
mParent = null
mReferrer = java.lang.String@3168862 (0x12e34cc0)
mResultCode = 0
mResultData = null
mResumed = false
mSearchEvent = null
mSearchManager = null
mStartedActivity = false
mStopped = true
mTaskDescription = android.app.ActivityManager$TaskDescription@319517344 (0x130b72a0)
mTemporaryPause = false
mTitle = java.lang.String@1894097 (0x70e5a400)
mTitleColor = 0
mTitleReady = true
mToken = android.os.BinderProxy@3197227 (0x130e9500)
mTranslucentCallback = null
mUiThread = java.lang.Thread@2021072 (0x78771dd0)
mVisibleBehind = false
mVisibleFromClient = true
mVisibleFromServer = true
mVoiceInteractor = null
mWindow = com.android.internal.policy.HwPhoneWindow@3167633 (0x12e16ce0)
mWindowAdded = true
mWindowManager = android.view.WindowManagerImpl@3198605 (0x1310af60)
mInflater = com.android.internal.policy.HwPhoneLayoutInflater@3170012 (0x12e50e20)
mOverrideConfiguration = null
mResources = android.content.res.HwResources@3164745 (0x12dd04c0)
mTheme = android.content.res.Resources$Theme@316415648 (0x12dc1ea0)
mThemeResource = 2131361857
mBase = android.app.ContextImpl@3148388 (0x12c40f20)
shadow$klass = com.zxsd.shoppingguide.activity.AggregationEntryActivity
shadow$monitor = 1073743756
Excluded Refs:
Field: android.view.Choreographer$FrameDisplayEventReceiver.mMessageQueue (always)
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)
图片说明

展开全部

  • 写回答

5条回答 默认 最新

  • zqbnqsdsmd 2017-02-18 07:42
    关注
    评论
  • m0_37611106 2017-03-06 00:31
    关注

    请问楼主是在什么情况下发生这个泄漏的,我也遇到了这个问题,但就是不知道是什么地方用到了GestureBoostManager,
    初步怀疑是用了ScrollView导致的,但项目中其他地方也用到了ScrollView就没问题,唯独某个页面报了这个泄漏!!有没有新
    进展,咱们讨论下

    评论
  • 吉凶以情迁 2017-03-21 19:15
    关注

    我也是 ,服了。 我也是这个手机。

    评论
  • zhf_827 2017-06-28 00:25
    关注

    我也遇到这问题了,请问楼主解决了吗?若是解决了 如何解决的?

    评论
  • qq_24452923 2017-07-19 22:43
    关注

    public void fixHuaWeiMemoryLeak() {
    if (!"HUAWEI".equals(Build.MANUFACTURER)) {
    return;
    }
    try {
    Class<?> GestureBoostManagerClass = Class.forName("android.gestureboost.GestureBoostManager");
    Field sGestureBoostManagerField = GestureBoostManagerClass.getDeclaredField("sGestureBoostManager");
    sGestureBoostManagerField.setAccessible(true);
    Object gestureBoostManager = sGestureBoostManagerField.get(GestureBoostManagerClass);
    Field contextField = GestureBoostManagerClass.getDeclaredField("mContext");
    contextField.setAccessible(true);
    if (contextField.get(gestureBoostManager) != null) {
    contextField.set(gestureBoostManager, null);

            }
        } catch (Throwable t) {
    
        }
    }
    
    
        在onDestroy()方法中调这个方法试试,也是网上找的。
    
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部