// We take a heap dump that includes a single instance of this // DumpedStuff class. Objects stored as fields in this class can be easily // found in the hprof dump by searching for the instance of the DumpedStuff // class and reading the desired field. publicclass DumpedStuff extends SuperDumpedStuff { privatevoid allocateObjectAtKnownSite() {
objectAllocatedAtKnownSite = new Object();
allocateObjectAtKnownSubSite();
allocateObjectAtObfSuperSite();
allocateObjectAtUnObfSuperSite();
allocateObjectAtOverriddenSite();
}
privatevoid allocateObjectAtKnownSubSite() {
objectAllocatedAtKnownSubSite = new Object();
}
publicvoid allocateObjectAtOverriddenSite() {
objectAllocatedAtOverriddenSite = new Object();
}
// Deep matching dominator trees shouldn't smash the stack when we try // to diff them. Make some deep dominator trees to help test it. for (int i = 0; i < 10000; i++) {
StackSmasher smasher = new StackSmasher();
smasher.child = stackSmasher;
stackSmasher = smasher;
if (!baseline) {
smasher = new StackSmasher();
smasher.child = stackSmasherAdded;
stackSmasherAdded = smasher;
}
}
public String basicString = "hello, world"; public String duplicateString1 = new String("duplicate"); public String duplicateString2 = new String("duplicate"); public String nonAscii = "Sigma (Ʃ) is not ASCII"; public String embeddedZero = "embedded\0..."; // Non-ASCII for string compression purposes. publicchar[] charArray = "char thing".toCharArray(); publicbyte[] byteString = newbyte[] {'h', 'i', '.', '\n', '\0', '\0', '\0'}; publicbyte[] byteNotString = newbyte[] {0, 1, 2, 3, 4, 5}; publicbyte[] byteEmpty = newbyte[] {}; public String nullString = null; public Object anObject = new Object(); public Object aCleanedObject = new Object(); public Runnable aCleanerThunk; public Reference aReference = new Reference(anObject); public ReferenceQueue<Object> referenceQueue = new ReferenceQueue<Object>(); public PhantomReference aPhantomReference = new PhantomReference(anObject, referenceQueue); public WeakReference aWeakReference = new WeakReference(anObject, referenceQueue); public WeakReference aNullReferentReference = new WeakReference(null, referenceQueue); public SoftReference aSoftReference = new SoftReference(new Object()); public Reference reachabilityReferenceChain; publicbyte[] bigArray; public Bitmap bitmapOne = null; public Bitmap bitmapTwo = null; public ObjectTree[] gcPathArray = new ObjectTree[]{null, null, new ObjectTree( new ObjectTree(null, new ObjectTree(null, null)), new ObjectTree(null, null)), null}; public Reference aLongStrongPathToSamplePathObject; public WeakReference aShortWeakPathToSamplePathObject; public WeakReference aWeakRefToGcRoot = new WeakReference(Main.class); public SoftReference aSoftChain = new SoftReference(new Reference(new Reference(new Object()))); public Object[] basicStringRef; public java.util.List<android.content.Context> activityLeaks = new java.util.ArrayList<>(); public AddedObject addedObject; public UnchangedObject unchangedObject = new UnchangedObject(); public RemovedObject removedObject; public ModifiedObject modifiedObject; public StackSmasher stackSmasher; public StackSmasher stackSmasherAdded; publicstatic String modifiedStaticField; publicint[] modifiedArray; public Object objectAllocatedAtKnownSite; public Object objectAllocatedAtKnownSubSite; public android.os.IBinder correctBinderProxy = new android.os.BinderProxy(); public android.os.IBinder imposedBinderProxy = new android.os.BinderProxy(); public android.os.IBinder carriedBinderProxy = new android.os.BinderProxy();
Object correctBinderProxyObject = new IDumpedManager.Stub.Proxy(correctBinderProxy);
Object impostorBinderProxyObject = new IBinderInterfaceImpostor.Stub.Proxy(imposedBinderProxy);
Object carrierBinderProxyObject = new BinderProxyCarrier(carriedBinderProxy);
Object binderService = new BinderService();
Object fakeBinderService = new FakeBinderService();
Object binderToken = new android.os.Binder();
Object namedBinderToken = new android.os.Binder("awesomeToken");
public android.os.Looper looper; public android.os.Handler handler; public android.os.Message message1; public android.os.Message message2; public android.os.Message barrierMessage;
Object unreachableAnchor = new Object();
// Allocate those objects that we need to not be GC'd before taking the heap // dump. publicvoid shouldNotGc() {
reachabilityReferenceChain = new Reference( new SoftReference( new Reference( new WeakReference( new SoftReference( new PhantomReference(new Object(), referenceQueue))))));
new Unreachable(unreachableAnchor);
}
static {
System.loadLibrary("ahat-test-jni");
}
privatestaticnativelong getNoopFreeFunction();
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet am 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.