com.squareup.leakcanary.HeapDump Java Examples
The following examples show how to use
com.squareup.leakcanary.HeapDump.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HeapAnalyzerService.java From DoraemonKit with Apache License 2.0 | 5 votes |
/** * 启动当前服务 * * @param context * @param heapDump * @param listenerServiceClass */ public static void runAnalysis(Context context, HeapDump heapDump, Class<? extends AbstractAnalysisResultService> listenerServiceClass) { LeakCanaryInternals.setEnabledBlocking(context, HeapAnalyzerService.class, true); LeakCanaryInternals.setEnabledBlocking(context, listenerServiceClass, true); Intent intent = new Intent(context, HeapAnalyzerService.class); intent.putExtra(LISTENER_CLASS_EXTRA, listenerServiceClass.getName()); intent.putExtra(HEAPDUMP_EXTRA, heapDump); ContextCompat.startForegroundService(context, intent); }
Example #2
Source File: HeapAnalyzerService.java From DoraemonKit with Apache License 2.0 | 5 votes |
/** * 服务启动时调用 * * @param intent */ @Override protected void onHandleIntentInForeground(@Nullable Intent intent) { if (intent == null) { CanaryLog.d("HeapAnalyzerService received a null intent, ignoring."); return; } //接受外部传递进来参数 String listenerClassName = intent.getStringExtra(LISTENER_CLASS_EXTRA); HeapDump heapDump = (HeapDump) intent.getSerializableExtra(HEAPDUMP_EXTRA); HeapAnalyzer heapAnalyzer = new HeapAnalyzer(heapDump.excludedRefs, this, heapDump.reachabilityInspectorClasses); // Instance instance = heapAnalyzer.preCheckForLeak(heapDump.heapDumpFile, heapDump.referenceKey); // String leakClassName = instance.getClassObj().getClassName(); // LogHelper.i(TAG, "====leakClassName====>" + leakClassName); // //过滤掉dokit内部的内存泄漏 // if (isIgnoreDokit && !TextUtils.isEmpty(leakClassName) && leakClassName.contains("com.didichuxing.doraemonkit")) { // return; // } /** * 检查对象是否没有被回收 */ AnalysisResult result = heapAnalyzer.checkForLeak(heapDump.heapDumpFile, heapDump.referenceKey, heapDump.computeRetainedHeapSize); AbstractAnalysisResultService.sendResultToListener(this, listenerClassName, heapDump, result); }
Example #3
Source File: LeakLoggerService.java From Alarmio with Apache License 2.0 | 5 votes |
@Override protected void afterDefaultHandling(HeapDump heapDump, AnalysisResult result, String leakInfo) { if (!result.leakFound || result.excludedLeak) { return; } Log.w("LeakCanary", leakInfo); }
Example #4
Source File: LeakLoggerService.java From braintree-android-drop-in with MIT License | 5 votes |
@Override protected void afterDefaultHandling(HeapDump heapDump, AnalysisResult result, String leakInfo) { if (!result.leakFound || result.excludedLeak) { return; } Log.w("LeakCanary", leakInfo); }
Example #5
Source File: HeapAnalyzerService.java From leakcanary-for-eclipse with MIT License | 5 votes |
public static void runAnalysis(Context context, HeapDump heapDump, Class<? extends AbstractAnalysisResultService> listenerServiceClass) { Intent intent = new Intent(context, HeapAnalyzerService.class); intent.putExtra(LISTENER_CLASS_EXTRA, listenerServiceClass.getName()); intent.putExtra(HEAPDUMP_EXTRA, heapDump); context.startService(intent); }
Example #6
Source File: HeapAnalyzerService.java From leakcanary-for-eclipse with MIT License | 5 votes |
@Override protected void onHandleIntent(Intent intent) { String listenerClassName = intent.getStringExtra(LISTENER_CLASS_EXTRA); HeapDump heapDump = (HeapDump) intent.getSerializableExtra(HEAPDUMP_EXTRA); ExcludedRefs androidExcludedDefault = createAndroidDefaults().build(); HeapAnalyzer heapAnalyzer = new HeapAnalyzer(androidExcludedDefault, heapDump.excludedRefs); AnalysisResult result = heapAnalyzer.checkForLeak(heapDump.heapDumpFile, heapDump.referenceKey); AbstractAnalysisResultService.sendResultToListener(this, listenerClassName, heapDump, result); }
Example #7
Source File: LeakLoggerService.java From braintree_android with MIT License | 5 votes |
@Override protected void afterDefaultHandling(HeapDump heapDump, AnalysisResult result, String leakInfo) { if (!result.leakFound || result.excludedLeak) { return; } Log.w("LeakCanary", leakInfo); }
Example #8
Source File: DisplayLeakActivity.java From leakcanary-for-eclipse with MIT License | 4 votes |
Leak(HeapDump heapDump, AnalysisResult result) { this.heapDump = heapDump; this.result = result; }