com.squareup.leakcanary.AnalysisResult Java Examples

The following examples show how to use com.squareup.leakcanary.AnalysisResult. 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 vote down vote up
/**
     * 服务启动时调用
     *
     * @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 #2
Source File: LeakLoggerService.java    From Alarmio with Apache License 2.0 5 votes vote down vote up
@Override
protected void afterDefaultHandling(HeapDump heapDump, AnalysisResult result, String leakInfo) {
    if (!result.leakFound || result.excludedLeak) {
        return;
    }

    Log.w("LeakCanary", leakInfo);
}
 
Example #3
Source File: LeakLoggerService.java    From braintree-android-drop-in with MIT License 5 votes vote down vote up
@Override
protected void afterDefaultHandling(HeapDump heapDump, AnalysisResult result, String leakInfo) {
    if (!result.leakFound || result.excludedLeak) {
        return;
    }

    Log.w("LeakCanary", leakInfo);
}
 
Example #4
Source File: HeapAnalyzerService.java    From leakcanary-for-eclipse with MIT License 5 votes vote down vote up
@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 #5
Source File: LeakLoggerService.java    From braintree_android with MIT License 5 votes vote down vote up
@Override
protected void afterDefaultHandling(HeapDump heapDump, AnalysisResult result, String leakInfo) {
    if (!result.leakFound || result.excludedLeak) {
        return;
    }

    Log.w("LeakCanary", leakInfo);
}
 
Example #6
Source File: DisplayLeakActivity.java    From leakcanary-for-eclipse with MIT License 4 votes vote down vote up
Leak(HeapDump heapDump, AnalysisResult result) {
    this.heapDump = heapDump;
    this.result = result;
}