Previous changes put unlinkedJavaLangClass on the heap. It makes
HprofReader unhappy, because it has a NULL class. So now we won't
dump objects with a NULL class. This also suppresses dumping of
uninitialized objects.
Change-Id: Ie6713d4e665ab6e518f13338367ee874903e2862
diff --git a/vm/hprof/HprofHeap.c b/vm/hprof/HprofHeap.c
index 31063e4..1738b57 100644
--- a/vm/hprof/HprofHeap.c
+++ b/vm/hprof/HprofHeap.c
@@ -267,16 +267,11 @@
clazz = obj->clazz;
if (clazz == NULL) {
- /* This object was probably just allocated and hasn't been
- * initialized yet. Add an instance entry to make a note of
- * it; there's not much else that we can do.
+ /* This object will bother HprofReader, because it has a NULL
+ * class, so just don't dump it. It could be
+ * gDvm.unlinkedJavaLangClass or it could be an object just
+ * allocated which hasn't been initialized yet.
*/
- hprofAddU1ToRecord(rec, HPROF_INSTANCE_DUMP);
-
- hprofAddIdToRecord(rec, (hprof_object_id)obj);
- hprofAddU4ToRecord(rec, stackTraceSerialNumber(obj));
- hprofAddIdToRecord(rec, (hprof_class_object_id)clazz); // NULL
- hprofAddIdToRecord(rec, 0); // no instance data
} else if (clazz == gDvm.unlinkedJavaLangClass) {
/* obj is a ClassObject that hasn't been linked yet.
*/