Из отчета об утечке данных Как понять, какие объекты являются мусором, а какие нет? - PullRequest
0 голосов
/ 20 ноября 2018

Вот мой код.Мне нужно понять, какие объекты являются мусором, а какие нет.Какие значения объектов присваиваются здесь null , они мусор?Изучив этот отчет, вы поймете, какие методы, какие классы собирать мусор или нет.где я могу найти ресурс для понимания отчета?

* Details:
* Class android.widget.Toast
|   static TAG = "Toast"
|   static localLOGV = false
|   static tContext = .MainActivity@315173888 (0x12c92c00)
|   static LENGTH_LONG = 1
|   static $classOverhead = byte[253]@1872109697 (0x6f962081)
|   static sService = android.app.INotificationManager$Stub$Proxy@319801664 (0x130fc940)
|   static LENGTH_SHORT = 0
* Instance of .MainActivity
|   static $assertionsDisabled = false
|   static $classOverhead = byte[3993]@314712065 (0x12c22001)
|   AllActivityFinisherThread = null
|   One_Hour = .MainActivity$14@314592800 (0x12c04e20)
|   RB1Hour = null
|   RB2H = null
|   RBInfinite = null
|   RBThirty = null
|   b = 0.13
|   billingManager =  (0x12c486c0)
|   bottomNavHider = null
|   bottomNavigation = android.widget.LinearLayout@316131328 (0x12d7c800)
|   bought = false
|   brightnesText = android.support.v7.widget.AppCompatTextView@316130304 (0x12d7c400)
|   brightness = android.widget.LinearLayout@315821056 (0x12d30c00)
|   brightnessHider = null
|   brightnessParam = android.view.WindowManager$LayoutParams@315992000 (0x12d5a7c0)
|   btnClosePopup = null
|   btnOK = null
|   cancel = false
|   cancel_button_click_listener = MainActivity$10@314592864 (0x12c04e60)
|   color = android.widget.LinearLayout@316139520 (0x12d7e800)
|   customPagerAdapter = .mineViewPager.CustomPagerAdapter@316966080 (0x12e484c0)
|   doubleBackToExitPressedOnce = java.lang.Boolean@1871492440 (0x6f8cb558)
|   finalSelectedButton = 0
|   firebaseAnalytics = com.google.firebase.analytics.FirebaseAnalytics@315593984 (0x12cf9500)
|   hide_bright = android.view.animation.AnimationSet@315020048 (0x12c6d310)
|   hourEt = null
|   i = 0
|   in_app_broadcast_cached = .MainActivity$InAppBroadCastCached@320842432 (0x131faac0)
|   in_app_broadcast_completed = MainActivity$InAppBroadCastCompleted@320842144 (0x131fa9a0)
|   in_app_broadcast_internet = .MainActivity$InAppBroadCastInternet@320842288 (0x131faa30)
|   in_app_broadcast_not_cached = MainActivity$InAppBroadCastNotCached@320842360 (0x131faa78)
|   in_app_broadcast_owner = .MainActivity$InAppBroadCastOwner@320842216 (0x131fa9e8)
|   infinite = MainActivity$12@314592832 (0x12c04e40)
|   infinite_btn_flag = true
|   isAnyAlertDialogShowing = false
|   isFinish = false
|   isTimerAlertDialogShowing = false
|   isanyRadioButtonSelected = true
|   layout = android.widget.RelativeLayout@315757568 (0x12d21400)
|   localBroadcastManager = android.support.v4.content.LocalBroadcastManager@315056640 (0x12c76200)
|   mAdView = com.google.android.gms.ads.AdView@315756544 (0x12d21000)
|   minuteEt = null
|   more = android.widget.LinearLayout@316152832 (0x12d81c00)
|   music = android.widget.LinearLayout@316143616 (0x12d7f800)
|   myRadioButtons = null
|   myRunnablePostDelayed = null
|   mySharedPreference = sharedPreference.MySharedPreference@314843848 (0x12c422c8)
|   myTimerBroadCast = MainActivity$MyTimerBroadCast@320842072 (0x131fa958)
|   myTimerThread = null
|   radioHour = 0
|   radioMinute = 0
|   remainingHourforThread = 0
|   remainingMinuteforThread = 0
|   remainingSecondforThread = 0
|   removeAdflag = false
|   restore = null
|   selectedButton = -1
|   setTimerFlag = false
|   set_timer = MainActivity$11@314592848 (0x12c04e50)
|   shouldBottomNavVisibleAlready = false
|   show_bright = android.view.animation.AnimationSet@315019904 (0x12c6d280)
|   slideDown = android.view.animation.AnimationSet@315020336 (0x12c6d430)
|   slideUp = android.view.animation.AnimationSet@315020192 (0x12c6d3a0)
|   testHour = -1
|   testMinute = -1
|   thirty_minute = MainActivity$13@314592816 (0x12c04e30)
|   timeInMilli = 100
|   timeInMilliTemporary = 100
|   timeInMillishelper = 0
|   timer = android.widget.LinearLayout@316134400 (0x12d7d400)
|   timerAlertDialog = null
|   timerTVBottomNav = null
|   timerlayourt = null
|   titleTimer = null
|   tv_remaining_hour = null
|   tv_remaining_minute = null
|   tv_remaining_second = null
|   two_hour = MainActivity$15@314592784 (0x12c04e10)
|   vanisherflag = true
|   viewPager = android.support.v4.view.ViewPager@315753472 (0x12d20400)
|   viewPagerOntouchLsitener = MainActivity$17@314581176 (0x12c020b8)
|   viewpagerPageChanged = MainActivity$16@314592768 (0x12c04e00)
|   window = com.android.internal.policy.PhoneWindow@316066000 (0x12d6c8d0)
|   mDelegate = android.support.v7.app.AppCompatDelegateImpl@315021200 (0x12c6d790)
|   mResources = null
|   mThemeId = 2131820881
|   mCreated = true
|   mFragments = android.support.v4.app.FragmentController@314592880 (0x12c04e70)
|   mHandler = android.support.v4.app.FragmentActivity$1@314870848 (0x12c48c40)
|   mNextCandidateRequestIndex = 0
|   mPendingFragmentActivityResults = android.support.v4.util.SparseArrayCompat@314844136 (0x12c423e8)
|   mRequestedPermissionsFromFragment = false
|   mResumed = false
|   mStartedActivityFromFragment = false
|   mStartedIntentSenderFromFragment = false
|   mStopped = true
|   mViewModelStore = null
|   mExtraDataMap = android.support.v4.util.SimpleArrayMap@314581872 (0x12c02370)
|   mLifecycleRegistry = android.arch.lifecycle.LifecycleRegistry@314871456 (0x12c48ea0)
|   mActionBar = null
|   mActionModeTypeStarting = 0
|   mActivityInfo = android.content.pm.ActivityInfo@315022352 (0x12c6dc10)
|   mActivityTransitionState = android.app.ActivityTransitionState@314800608 (0x12c379e0)
|   mApplication = DetectLeak@314870272 (0x12c48a00)
|   mCalled = true
|   mChangeCanvasToTranslucent = false
|   mChangingConfigurations = false
|   mComponent = android.content.ComponentName@314752688 (0x12c2beb0)
|   mConfigChangeFlags = 0
|   mCurrentConfig = android.content.res.Configuration@315281760 (0x12cad160)
|   mDecor = null
|   mDefaultKeyMode = 0
|   mDefaultKeySsb = null
|   mDestroyed = true
|   mDoReportFullyDrawn = false
|   mEatKeyUpEvent = false
|   mEmbeddedID = null
|   mEnableDefaultActionBarUp = false
|   mEnterTransitionListener = android.app.SharedElementCallback$1@1871560280 (0x6f8dbe58)
|   mExitTransitionListener = android.app.SharedElementCallback$1@1871560280 (0x6f8dbe58)
|   mFinished = true
|   mFragments = android.app.FragmentController@314593056 (0x12c04f20)
|   mHandler = android.os.Handler@314740864 (0x12c29080)
|   mHasCurrentPermissionsRequest = false
|   mIdent = 225691438
|   mInstanceTracker = android.os.StrictMode$InstanceTracker@314593040 (0x12c04f10)
|   mInstrumentation = android.app.Instrumentation@314908952 (0x12c52118)
|   mIntent = android.content.Intent@315084744 (0x12c7cfc8)
|   mLastNonConfigurationInstances = null
|   mMainThread = android.app.ActivityThread@314806624 (0x12c39160)
|   mManagedCursors = java.util.ArrayList@314581920 (0x12c023a0)
|   mManagedDialogs = null
|   mMenuInflater = null
|   mParent = null
|   mReferrer = ""
|   mResultCode = 0
|   mResultData = null
|   mResumed = false
|   mSearchEvent = null
|   mSearchManager = null
|   mStartedActivity = false
|   mStopped = true
|   mTaskDescription = android.app.ActivityManager$TaskDescription@314740832 (0x12c29060)
|   mTemporaryPause = false
|   mTitle = "Table Lamp"
|   mTitleColor = 0
|   mTitleReady = true
|   mToken = android.os.BinderProxy@314758016 (0x12c2d380)
|   mTranslucentCallback = null
|   mUiThread = java.lang.Thread@1959512464 (0x74cbc990)
|   mVisibleBehind = false
|   mVisibleFromClient = true
|   mVisibleFromServer = true
|   mVoiceInteractor = null
|   mWindow = com.android.internal.policy.PhoneWindow@316066000 (0x12d6c8d0)
|   mWindowAdded = true
|   mWindowManager = android.view.WindowManagerImpl@314845696 (0x12c42a00)
|   mInflater = com.android.internal.policy.PhoneLayoutInflater@314754624 (0x12c2c640)
|   mOverrideConfiguration = null
|   mResources = android.content.res.Resources@315519552 (0x12ce7240)
|   mTheme = android.content.res.Resources$Theme@314591872 (0x12c04a80)
|   mThemeResource = 2131820881
|   mBase = android.app.ContextImpl@314672624 (0x12c185f0)
|   shadow$_klass_ = MainActivity
|   shadow$_monitor_ = -1952112838
* Excluded Refs:
| 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.accounts.AccountManager$AmsTask$Response.this$1
| Field: android.os.UserManager.mContext
| Field: com.android.internal.policy.BackdropFrameRenderer.mDecorView
| Field: android.view.Choreographer$FrameDisplayEventReceiver.mMessageQueue 

1 Ответ

0 голосов
/ 23 ноября 2018

Я бы посоветовал проверить "Где я могу узнать больше? - квадрат / утечка канареи в хранилище LeakCanary.

Если вы посмотрите на поля экземпляра MainActivity, вы увидите mStopped = true и mDestroyed = true. Документация для onDestroy гласит:

Выполните окончательную очистку до того, как действие будет уничтожено.

Поскольку mDestroyed верно, мы можем заключить, что этот экземпляр должен быть готов к сборке, но что-то мешает этому. Довольно сложно найти причину этого, не видя исходного кода, поэтому не стесняйтесь редактировать свой квест с ним, если вам нужна поддержка в устранении этой утечки.

...