├── leakcanarylib ├── libs │ └── haha-2.0.2.jar ├── res │ ├── drawable-hdpi │ │ ├── leak_canary_icon.png │ │ └── leak_canary_notification.png │ ├── drawable-mdpi │ │ ├── leak_canary_icon.png │ │ └── leak_canary_notification.png │ ├── drawable-xhdpi │ │ ├── leak_canary_icon.png │ │ └── leak_canary_notification.png │ ├── drawable-xxhdpi │ │ ├── leak_canary_icon.png │ │ └── leak_canary_notification.png │ ├── drawable-xxxhdpi │ │ ├── leak_canary_icon.png │ │ └── leak_canary_notification.png │ ├── drawable-hdpi-v11 │ │ └── leak_canary_notification.png │ ├── drawable-mdpi-v11 │ │ └── leak_canary_notification.png │ ├── drawable-xhdpi-v11 │ │ └── leak_canary_notification.png │ ├── drawable-xxhdpi-v11 │ │ └── leak_canary_notification.png │ ├── drawable-xxxhdpi-v11 │ │ └── leak_canary_notification.png │ ├── drawable │ │ └── leak_canary_toast_background.xml │ ├── values │ │ ├── leak_canary_int.xml │ │ ├── leak_canary_themes.xml │ │ └── leak_canary_strings.xml │ ├── values-v14 │ │ └── leak_canary_themes.xml │ ├── values-v21 │ │ └── leak_canary_themes.xml │ └── layout │ │ ├── leak_canary_ref_top_row.xml │ │ ├── leak_canary_heap_dump_toast.xml │ │ ├── leak_canary_leak_row.xml │ │ ├── leak_canary_display_leak.xml │ │ └── leak_canary_ref_row.xml ├── lint.xml ├── .classpath ├── src │ ├── org │ │ └── eclipse │ │ │ └── mat │ │ │ ├── util │ │ │ ├── MessageUtil.java │ │ │ ├── SilentProgressListener.java │ │ │ ├── SimpleStringTokenizer.java │ │ │ ├── VoidProgressListener.java │ │ │ └── SimpleMonitor.java │ │ │ ├── collect │ │ │ ├── IteratorInt.java │ │ │ ├── IteratorLong.java │ │ │ ├── PrimeFinder.java │ │ │ ├── QueueInt.java │ │ │ ├── BitField.java │ │ │ ├── ArrayInt.java │ │ │ └── ArrayLong.java │ │ │ ├── hprof │ │ │ ├── extension │ │ │ │ ├── IRuntimeEnhancer.java │ │ │ │ └── IParsingEnhancer.java │ │ │ ├── ArrayDescription.java │ │ │ └── IHprofParserHandler.java │ │ │ ├── snapshot │ │ │ ├── model │ │ │ │ ├── IArray.java │ │ │ │ ├── NamedReference.java │ │ │ │ ├── IObjectArray.java │ │ │ │ ├── PseudoReference.java │ │ │ │ ├── Field.java │ │ │ │ ├── IStackFrame.java │ │ │ │ ├── IThreadStack.java │ │ │ │ ├── IClassLoader.java │ │ │ │ ├── IInstance.java │ │ │ │ ├── FieldDescriptor.java │ │ │ │ ├── ThreadToLocalReference.java │ │ │ │ ├── ObjectReference.java │ │ │ │ ├── PrettyPrinter.java │ │ │ │ ├── IPrimitiveArray.java │ │ │ │ └── IClass.java │ │ │ ├── extension │ │ │ │ ├── Subject.java │ │ │ │ ├── Subjects.java │ │ │ │ └── IClassSpecificNameResolver.java │ │ │ ├── SnapshotFormat.java │ │ │ ├── ExcludedReferencesDescriptor.java │ │ │ ├── PathsFromGCRootsTree.java │ │ │ ├── IMultiplePathsFromGCRootsComputer.java │ │ │ └── IPathsFromGCRootsComputer.java │ │ │ ├── parser │ │ │ ├── model │ │ │ │ ├── XGCRootInfo.java │ │ │ │ ├── XSnapshotInfo.java │ │ │ │ ├── AbstractArrayImpl.java │ │ │ │ └── PrimitiveArrayImpl.java │ │ │ ├── internal │ │ │ │ ├── StackFrameImpl.java │ │ │ │ ├── ThreadStackImpl.java │ │ │ │ ├── util │ │ │ │ │ ├── IntStack.java │ │ │ │ │ └── ParserRegistry.java │ │ │ │ ├── snapshot │ │ │ │ │ ├── PathsFromGCRootsTreeBuilder.java │ │ │ │ │ ├── ObjectCache.java │ │ │ │ │ └── RetainedSizeCache.java │ │ │ │ ├── PreliminaryIndexImpl.java │ │ │ │ └── SnapshotImplBuilder.java │ │ │ ├── IIndexBuilder.java │ │ │ ├── IObjectReader.java │ │ │ ├── index │ │ │ │ └── IIndexReader.java │ │ │ ├── IPreliminaryIndex.java │ │ │ └── io │ │ │ │ ├── BitInputStream.java │ │ │ │ ├── BitOutputStream.java │ │ │ │ └── BufferedRandomAccessInputStream.java │ │ │ └── SnapshotException.java │ └── com │ │ └── squareup │ │ ├── leakcanary │ │ ├── AndroidDebuggerControl.java │ │ ├── HeapDumper.java │ │ ├── DebuggerControl.java │ │ ├── Preconditions.java │ │ ├── LeakNode.java │ │ ├── KeyedWeakReference.java │ │ ├── internal │ │ │ ├── FutureResult.java │ │ │ ├── LeakCanaryUi.java │ │ │ ├── MoreDetailsView.java │ │ │ ├── HeapAnalyzerService.java │ │ │ └── DisplayLeakConnectorView.java │ │ ├── CanaryLog.java │ │ ├── ServiceHeapDumpListener.java │ │ ├── GcTrigger.java │ │ ├── LeakTrace.java │ │ ├── AndroidWatchExecutor.java │ │ ├── AbstractAnalysisResultService.java │ │ ├── AnalysisResult.java │ │ ├── HeapDump.java │ │ ├── ActivityRefWatcher.java │ │ └── LeakTraceElement.java │ │ └── haha │ │ └── perflib │ │ └── HahaSpy.java ├── .settings │ └── org.eclipse.jdt.core.prefs ├── project.properties ├── proguard-project.txt ├── .project └── AndroidManifest.xml ├── LeakcanarySample ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ ├── values │ │ ├── dimens.xml │ │ ├── styles.xml │ │ └── strings.xml │ ├── layout │ │ ├── activity_main2.xml │ │ ├── fragment_main2.xml │ │ └── activity_main.xml │ └── values-w820dp │ │ └── dimens.xml ├── .settings │ └── org.eclipse.jdt.core.prefs ├── src │ └── com │ │ └── leakcanary │ │ └── example │ │ ├── BaseFragment.java │ │ ├── DebugMApplication.java │ │ ├── LeakUploadService.java │ │ ├── MApplication.java │ │ ├── Main2Activity.java │ │ └── MainActivity.java ├── .classpath ├── project.properties ├── proguard-project.txt ├── .project └── AndroidManifest.xml ├── README.md ├── .gitattributes └── .gitignore /leakcanarylib/libs/haha-2.0.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teffy/LeakcanarySample-Eclipse/HEAD/leakcanarylib/libs/haha-2.0.2.jar -------------------------------------------------------------------------------- /LeakcanarySample/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teffy/LeakcanarySample-Eclipse/HEAD/LeakcanarySample/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /LeakcanarySample/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teffy/LeakcanarySample-Eclipse/HEAD/LeakcanarySample/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /LeakcanarySample/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teffy/LeakcanarySample-Eclipse/HEAD/LeakcanarySample/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /LeakcanarySample/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teffy/LeakcanarySample-Eclipse/HEAD/LeakcanarySample/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /leakcanarylib/res/drawable-hdpi/leak_canary_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teffy/LeakcanarySample-Eclipse/HEAD/leakcanarylib/res/drawable-hdpi/leak_canary_icon.png -------------------------------------------------------------------------------- /leakcanarylib/res/drawable-mdpi/leak_canary_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teffy/LeakcanarySample-Eclipse/HEAD/leakcanarylib/res/drawable-mdpi/leak_canary_icon.png -------------------------------------------------------------------------------- /leakcanarylib/res/drawable-xhdpi/leak_canary_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teffy/LeakcanarySample-Eclipse/HEAD/leakcanarylib/res/drawable-xhdpi/leak_canary_icon.png -------------------------------------------------------------------------------- /leakcanarylib/res/drawable-xxhdpi/leak_canary_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teffy/LeakcanarySample-Eclipse/HEAD/leakcanarylib/res/drawable-xxhdpi/leak_canary_icon.png -------------------------------------------------------------------------------- /leakcanarylib/res/drawable-xxxhdpi/leak_canary_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teffy/LeakcanarySample-Eclipse/HEAD/leakcanarylib/res/drawable-xxxhdpi/leak_canary_icon.png -------------------------------------------------------------------------------- /leakcanarylib/res/drawable-hdpi/leak_canary_notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teffy/LeakcanarySample-Eclipse/HEAD/leakcanarylib/res/drawable-hdpi/leak_canary_notification.png -------------------------------------------------------------------------------- /leakcanarylib/res/drawable-mdpi/leak_canary_notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teffy/LeakcanarySample-Eclipse/HEAD/leakcanarylib/res/drawable-mdpi/leak_canary_notification.png -------------------------------------------------------------------------------- /leakcanarylib/res/drawable-xhdpi/leak_canary_notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teffy/LeakcanarySample-Eclipse/HEAD/leakcanarylib/res/drawable-xhdpi/leak_canary_notification.png -------------------------------------------------------------------------------- /leakcanarylib/res/drawable-xxhdpi/leak_canary_notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teffy/LeakcanarySample-Eclipse/HEAD/leakcanarylib/res/drawable-xxhdpi/leak_canary_notification.png -------------------------------------------------------------------------------- /leakcanarylib/res/drawable-xxxhdpi/leak_canary_notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teffy/LeakcanarySample-Eclipse/HEAD/leakcanarylib/res/drawable-xxxhdpi/leak_canary_notification.png -------------------------------------------------------------------------------- /leakcanarylib/res/drawable-hdpi-v11/leak_canary_notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teffy/LeakcanarySample-Eclipse/HEAD/leakcanarylib/res/drawable-hdpi-v11/leak_canary_notification.png -------------------------------------------------------------------------------- /leakcanarylib/res/drawable-mdpi-v11/leak_canary_notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teffy/LeakcanarySample-Eclipse/HEAD/leakcanarylib/res/drawable-mdpi-v11/leak_canary_notification.png -------------------------------------------------------------------------------- /leakcanarylib/res/drawable-xhdpi-v11/leak_canary_notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teffy/LeakcanarySample-Eclipse/HEAD/leakcanarylib/res/drawable-xhdpi-v11/leak_canary_notification.png -------------------------------------------------------------------------------- /leakcanarylib/res/drawable-xxhdpi-v11/leak_canary_notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teffy/LeakcanarySample-Eclipse/HEAD/leakcanarylib/res/drawable-xxhdpi-v11/leak_canary_notification.png -------------------------------------------------------------------------------- /leakcanarylib/res/drawable-xxxhdpi-v11/leak_canary_notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teffy/LeakcanarySample-Eclipse/HEAD/leakcanarylib/res/drawable-xxxhdpi-v11/leak_canary_notification.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [DEPARTED] 2 | 请参照 [Leakcanary](https://github.com/square/leakcanary) 使用方式。 3 | 4 | # LeakcanarySample-Eclipse 5 | 6 | 本项目是根据 [Leakcanary](https://github.com/square/leakcanary) 项目(version 1.3.1)改造为适用于Eclipse。 7 | 8 | -------------------------------------------------------------------------------- /LeakcanarySample/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 3 | org.eclipse.jdt.core.compiler.compliance=1.6 4 | org.eclipse.jdt.core.compiler.source=1.6 5 | -------------------------------------------------------------------------------- /leakcanarylib/lint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /leakcanarylib/res/drawable/leak_canary_toast_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /LeakcanarySample/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /LeakcanarySample/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /LeakcanarySample/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LeakcanarySample 5 | Hello world! 6 | Settings 7 | Main2Activity 8 | 9 | 10 | -------------------------------------------------------------------------------- /LeakcanarySample/res/layout/activity_main2.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | -------------------------------------------------------------------------------- /LeakcanarySample/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 64dp 9 | 10 | 11 | -------------------------------------------------------------------------------- /LeakcanarySample/src/com/leakcanary/example/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package com.leakcanary.example; 2 | 3 | import android.annotation.TargetApi; 4 | import android.app.Fragment; 5 | import android.os.Build; 6 | 7 | @TargetApi(Build.VERSION_CODES.HONEYCOMB) 8 | public class BaseFragment extends Fragment { 9 | 10 | @Override 11 | public void onDestroy() { 12 | super.onDestroy(); 13 | MApplication.getRefWatcher(getActivity()).watch(this); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /leakcanarylib/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /LeakcanarySample/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /leakcanarylib/src/org/eclipse/mat/util/MessageUtil.java: -------------------------------------------------------------------------------- 1 | package org.eclipse.mat.util; 2 | 3 | import java.text.MessageFormat; 4 | 5 | import org.eclipse.mat.hprof.Messages; 6 | 7 | public final class MessageUtil { 8 | 9 | public static String format(Messages message, Object... objects) { 10 | if (objects.length == 0) { 11 | return message.pattern; 12 | } 13 | return MessageFormat.format(message.pattern, objects); 14 | } 15 | 16 | private MessageUtil() { 17 | throw new AssertionError(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /leakcanarylib/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.7 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.7 12 | -------------------------------------------------------------------------------- /leakcanarylib/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-22 15 | android.library=true 16 | -------------------------------------------------------------------------------- /LeakcanarySample/src/com/leakcanary/example/DebugMApplication.java: -------------------------------------------------------------------------------- 1 | package com.leakcanary.example; 2 | 3 | import android.app.Application; 4 | 5 | import com.squareup.leakcanary.AndroidExcludedRefs; 6 | import com.squareup.leakcanary.LeakCanary; 7 | import com.squareup.leakcanary.RefWatcher; 8 | 9 | /** 10 | * 如果要处理上传问题,需要自定义RefWatcher和一个DisplayLeakService的子类LeakUploadService 11 | * 注意:需在manifest中声明DebugMApplication和LeakUploadService 12 | */ 13 | public class DebugMApplication extends Application { 14 | 15 | protected RefWatcher installLeakCanary() { 16 | return LeakCanary.install(this, LeakUploadService.class, AndroidExcludedRefs.createAppDefaults().build()); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /LeakcanarySample/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-22 15 | android.library.reference.1=../leakcanarylib 16 | -------------------------------------------------------------------------------- /LeakcanarySample/src/com/leakcanary/example/LeakUploadService.java: -------------------------------------------------------------------------------- 1 | package com.leakcanary.example; 2 | 3 | import com.squareup.leakcanary.AnalysisResult; 4 | import com.squareup.leakcanary.DisplayLeakService; 5 | import com.squareup.leakcanary.HeapDump; 6 | 7 | public class LeakUploadService extends DisplayLeakService { 8 | 9 | @Override 10 | protected void afterDefaultHandling(HeapDump heapDump, 11 | AnalysisResult result, String leakInfo) { 12 | super.afterDefaultHandling(heapDump, result, leakInfo); 13 | if (!result.leakFound || result.excludedLeak) { 14 | return; 15 | } 16 | //TODO 可以在这里处理上传log的逻辑 17 | // https://gist.github.com/pyricau/06c2c486d24f5f85f7f0 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /leakcanarylib/src/org/eclipse/mat/collect/IteratorInt.java: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * Copyright (c) 2008 SAP AG. 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the Eclipse Public License v1.0 6 | * which accompanies this distribution, and is available at 7 | * http://www.eclipse.org/legal/epl-v10.html 8 | * 9 | * Contributors: 10 | * SAP AG - initial API and implementation 11 | * ***************************************************************************** 12 | */ 13 | package org.eclipse.mat.collect; 14 | 15 | public interface IteratorInt { 16 | boolean hasNext(); 17 | 18 | int next(); 19 | } 20 | -------------------------------------------------------------------------------- /leakcanarylib/src/org/eclipse/mat/collect/IteratorLong.java: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * Copyright (c) 2008 SAP AG. 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the Eclipse Public License v1.0 6 | * which accompanies this distribution, and is available at 7 | * http://www.eclipse.org/legal/epl-v10.html 8 | * 9 | * Contributors: 10 | * SAP AG - initial API and implementation 11 | * ***************************************************************************** 12 | */ 13 | package org.eclipse.mat.collect; 14 | 15 | public interface IteratorLong { 16 | boolean hasNext(); 17 | 18 | long next(); 19 | } 20 | -------------------------------------------------------------------------------- /LeakcanarySample/res/layout/fragment_main2.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /leakcanarylib/res/values/leak_canary_int.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 7 19 | -------------------------------------------------------------------------------- /leakcanarylib/res/values/leak_canary_themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | -------------------------------------------------------------------------------- /leakcanarylib/res/values-v14/leak_canary_themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | -------------------------------------------------------------------------------- /leakcanarylib/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /leakcanarylib/res/values-v21/leak_canary_themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | -------------------------------------------------------------------------------- /LeakcanarySample/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /leakcanarylib/src/org/eclipse/mat/hprof/extension/IRuntimeEnhancer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * Copyright (c) 2008 SAP AG. 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the Eclipse Public License v1.0 6 | * which accompanies this distribution, and is available at 7 | * http://www.eclipse.org/legal/epl-v10.html 8 | * 9 | * Contributors: 10 | * SAP AG - initial API and implementation 11 | * ***************************************************************************** 12 | */ 13 | package org.eclipse.mat.hprof.extension; 14 | 15 | import org.eclipse.mat.SnapshotException; 16 | import org.eclipse.mat.snapshot.ISnapshot; 17 | 18 | public interface IRuntimeEnhancer { 19 | A getAddon(ISnapshot snapshot, Class addon) throws SnapshotException; 20 | } 21 | -------------------------------------------------------------------------------- /leakcanarylib/src/org/eclipse/mat/snapshot/model/IArray.java: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * Copyright (c) 2008 SAP AG. 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the Eclipse Public License v1.0 6 | * which accompanies this distribution, and is available at 7 | * http://www.eclipse.org/legal/epl-v10.html 8 | * 9 | * Contributors: 10 | * SAP AG - initial API and implementation 11 | * ***************************************************************************** 12 | */ 13 | package org.eclipse.mat.snapshot.model; 14 | 15 | /** 16 | * Interface for an array object in the heap dump. 17 | * 18 | * @noimplement 19 | */ 20 | public interface IArray extends IObject { 21 | /** 22 | * Returns the length of the object. 23 | */ 24 | public int getLength(); 25 | } 26 | -------------------------------------------------------------------------------- /leakcanarylib/src/org/eclipse/mat/hprof/extension/IParsingEnhancer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * Copyright (c) 2008 SAP AG. 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the Eclipse Public License v1.0 6 | * which accompanies this distribution, and is available at 7 | * http://www.eclipse.org/legal/epl-v10.html 8 | * 9 | * Contributors: 10 | * SAP AG - initial API and implementation 11 | * ***************************************************************************** 12 | */ 13 | package org.eclipse.mat.hprof.extension; 14 | 15 | import java.io.IOException; 16 | 17 | import org.eclipse.mat.SnapshotException; 18 | import org.eclipse.mat.snapshot.SnapshotInfo; 19 | 20 | public interface IParsingEnhancer { 21 | void onParsingCompleted(SnapshotInfo snapshotInfo) throws SnapshotException, IOException; 22 | } 23 | -------------------------------------------------------------------------------- /leakcanarylib/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Leakcanary 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /LeakcanarySample/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | LeakcanarySample 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /leakcanarylib/src/org/eclipse/mat/snapshot/extension/Subject.java: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * Copyright (c) 2008 SAP AG. 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the Eclipse Public License v1.0 6 | * which accompanies this distribution, and is available at 7 | * http://www.eclipse.org/legal/epl-v10.html 8 | * 9 | * Contributors: 10 | * SAP AG - initial API and implementation 11 | * ***************************************************************************** 12 | */ 13 | package org.eclipse.mat.snapshot.extension; 14 | 15 | import static java.lang.annotation.ElementType.TYPE; 16 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 17 | 18 | import java.lang.annotation.Retention; 19 | import java.lang.annotation.Target; 20 | 21 | @Target({ TYPE }) @Retention(RUNTIME) public @interface Subject { 22 | String value(); 23 | } 24 | -------------------------------------------------------------------------------- /leakcanarylib/src/com/squareup/leakcanary/AndroidDebuggerControl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Square, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.squareup.leakcanary; 17 | 18 | import android.os.Debug; 19 | 20 | public final class AndroidDebuggerControl implements DebuggerControl { 21 | @Override public boolean isDebuggerAttached() { 22 | return Debug.isDebuggerConnected(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /leakcanarylib/src/org/eclipse/mat/snapshot/extension/Subjects.java: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * Copyright (c) 2008 SAP AG. 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the Eclipse Public License v1.0 6 | * which accompanies this distribution, and is available at 7 | * http://www.eclipse.org/legal/epl-v10.html 8 | * 9 | * Contributors: 10 | * SAP AG - initial API and implementation 11 | * ***************************************************************************** 12 | */ 13 | package org.eclipse.mat.snapshot.extension; 14 | 15 | import static java.lang.annotation.ElementType.TYPE; 16 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 17 | 18 | import java.lang.annotation.Retention; 19 | import java.lang.annotation.Target; 20 | 21 | @Target({ TYPE }) @Retention(RUNTIME) public @interface Subjects { 22 | String[] value(); 23 | } 24 | -------------------------------------------------------------------------------- /leakcanarylib/src/com/squareup/leakcanary/HeapDumper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Square, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.squareup.leakcanary; 17 | 18 | import java.io.File; 19 | 20 | public interface HeapDumper { 21 | 22 | File NO_DUMP = null; 23 | 24 | /** 25 | * @return a {@link File} referencing the heap dump, or {@link #NO_DUMP} if the heap could not be 26 | * dumped. 27 | */ 28 | File dumpHeap(); 29 | } -------------------------------------------------------------------------------- /leakcanarylib/src/org/eclipse/mat/snapshot/SnapshotFormat.java: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * Copyright (c) 2008 SAP AG. 4 | * All rights reserved. This program and the accompanying materials 5 | * are made available under the terms of the Eclipse Public License v1.0 6 | * which accompanies this distribution, and is available at 7 | * http://www.eclipse.org/legal/epl-v10.html 8 | * 9 | * Contributors: 10 | * SAP AG - initial API and implementation 11 | * ***************************************************************************** 12 | */ 13 | package org.eclipse.mat.snapshot; 14 | 15 | /** 16 | * @noinstantiate 17 | */ 18 | public class SnapshotFormat { 19 | private String name; 20 | private String[] fileExtensions; 21 | 22 | public SnapshotFormat(String name, String[] fileExtensions) { 23 | this.fileExtensions = fileExtensions; 24 | this.name = name; 25 | } 26 | 27 | public String getName() { 28 | return name; 29 | } 30 | 31 | public String[] getFileExtensions() { 32 | return fileExtensions; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /LeakcanarySample/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 11 | 12 |