Put app image objects in HPROF_HEAP_APP instead of HPROF_HEAP_IMAGE
Tools usually hide HPROF_HEAP_IMAGE and HPROF_HEAP_ZYGOTE classes,
so we probably don't want app classes in there.
Regression test is infeasible since we don't have a way to parse
hprof files from run-tests.
Test: test-art-host
Bug: 35762934
Change-Id: I56f4feb010a2e6cd290dfabdd8118e476098e40d
diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc
index e59c4bb..495fec7 100644
--- a/runtime/hprof/hprof.cc
+++ b/runtime/hprof/hprof.cc
@@ -1111,7 +1111,9 @@
if (space != nullptr) {
if (space->IsZygoteSpace()) {
heap_type = HPROF_HEAP_ZYGOTE;
- } else if (space->IsImageSpace()) {
+ } else if (space->IsImageSpace() && heap->ObjectIsInBootImageSpace(obj)) {
+ // Only count objects in the boot image as HPROF_HEAP_IMAGE, this leaves app image objects as
+ // HPROF_HEAP_APP. b/35762934
heap_type = HPROF_HEAP_IMAGE;
}
} else {