Skip to content

Instantly share code, notes, and snippets.

PY pyricau

Block or report user

Report or block pyricau

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View BugsnagLeakUploader.kt
package com.squareup.leakcanary
import android.app.Application
import com.bugsnag.android.Client
import com.bugsnag.android.MetaData
import com.bugsnag.android.Severity.ERROR
import com.squareup.leakcanary.BugsnagLeakUploader.ReportType.FAILURE
import com.squareup.leakcanary.BugsnagLeakUploader.ReportType.LEAK
import com.squareup.leakcanary.BugsnagLeakUploader.ReportType.NOT_FOUND
import com.squareup.leakcanary.BugsnagLeakUploader.ReportType.WONT_FIX_LEAK
View build.gradle
dependencies {
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.1'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.1'
// Optional, if you use support library fragments:
debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.1'
}
View Lol.java
import java.util.concurrent.Callable;
public enum Lol implements Callable<CharSequence> {
ಠ_ಠ {
@Override public String call() {
return "Foo";
}
};
View gist:8becbc14aeb670368ff8
GC Roots: 242256
System class root total: 197490 real: 90556 undefined: 106934
============
Undefined System Class roots:
long[] of size 65200: 26310
java.lang.Class[] of size 7570: 26310
java.lang.Class[] of size 3405: 12342
long[] of size 32034: 12342
long[] of size 29221: 10101
java.lang.Class[] of size 3097: 10101
@pyricau
pyricau / LeakSlackUploadService.java
Created May 9, 2015
Sending Leak Traces to a Slack Channel (and HipChat, see the comments)
View LeakSlackUploadService.java
import android.util.Log;
import com.squareup.leakcanary.AnalysisResult;
import com.squareup.leakcanary.DisplayLeakService;
import com.squareup.leakcanary.HeapDump;
import retrofit.RestAdapter;
import retrofit.RetrofitError;
import retrofit.http.Multipart;
import retrofit.http.POST;
import retrofit.http.Part;
import retrofit.mime.TypedFile;
@pyricau
pyricau / OomExceptionHandler.java
Created May 6, 2015
Dump the heap on OutOfMemoryError crashes in your debug builds.
View OomExceptionHandler.java
import android.content.Context;
import android.os.Debug;
import java.io.File;
public class OomExceptionHandler implements Thread.UncaughtExceptionHandler {
private static final String FILENAME = "out-of-memory.hprof";
public static void install(Context context) {
Thread.UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler();
@pyricau
pyricau / IMMLeaks.java
Last active Aug 24, 2019
"Fix" for InputMethodManager leaking the last focused view: https://code.google.com/p/android/issues/detail?id=171190
View IMMLeaks.java
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.ContextWrapper;
import android.os.Bundle;
import android.os.Looper;
import android.os.MessageQueue;
import android.util.Log;
import android.view.View;
import android.view.ViewTreeObserver;
@pyricau
pyricau / Test.java
Created Dec 10, 2013
Does this compile? Why?
View Test.java
import java.util.List;
public class Test<T> {
public static String getFirst(Test test) {
return test.strings.get(0);
}
List<String> strings;
}
@pyricau
pyricau / gist:5330096
Created Apr 7, 2013
Nice stacktrace on airfrance.us !
View gist:5330096
JSP Processing Error
HTTP Error Code: 500
Error Message:
JSPG0049E: /US/fr/local/rebooking/standard/rbk_standard_recap.jsp failed to compile :
JSPG0091E: An error occurred at line: 403 in the file: /US/fr/local/rebooking/standard/rbk_standard_recap.jsp
JSPG0093E: Generated servlet error from file: /US/fr/local/rebooking/standard/rbk_standard_recap.jsp
/exploit/was6/prd/cells/ASQVIPB2CB01/temp/qvipb2cb01n7/WVPB2CB01b2c_bServer_n7s4/WVPB2CB01b2c_b_B2CEAR_App/B2CWeb.war/US/fr/local/rebooking/standard/_rbk_5F_standard_5F_recap.java : 2291 : The method isConfirmationRecap() is undefined for the type RecapRbkDisplayBean
JSPG0091E: An error occurred at line: 816 in the file: /US/fr/local/rebooking/standard/rbk_standard_recap.jsp
View gist:4389643

Current implementation of findViewById() :

public class View {

    public final View findViewById(int id) {
        if (id < 0) {
            return null;
        }
        return findViewTraversal(id);
You can’t perform that action at this time.