summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2015-08-28 18:15:27 -0700
committerThe Android Automerger <android-build@google.com>2015-08-28 19:53:51 -0700
commitd8e28505f0be821475c7b18a416aa4f1a9e2871d (patch)
tree724058f1db5c0789c3a3c26fdd8be55018a6e2be
parent22d48a819a5171fea19bcaacf7efb113edf5f524 (diff)
downloadart-d8e28505f0be821475c7b18a416aa4f1a9e2871d.zip
art-d8e28505f0be821475c7b18a416aa4f1a9e2871d.tar.gz
art-d8e28505f0be821475c7b18a416aa4f1a9e2871d.tar.bz2
ART: Weaken size check in hprof
Dumping the heap is a two-phase process. In the first phase, all objects are visited to fill the header tables. In the second phase, the tables are written out and the heap is visited again to write the object records. Deleting global references doesn't require the mutator lock. So it is possible to delete a global ref in-between the first and the second phase. This leads to a smaller set of object records. The result is still safe, as the object's class etc. is still in the header tables, and the object won't be deleted, so will still be dumped by itself. Bug: 23521263 Change-Id: I019c29b13ceb9f13e362c742662f1546d52c37a0
-rw-r--r--runtime/hprof/hprof.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc
index a2a4f0d..ba28861 100644
--- a/runtime/hprof/hprof.cc
+++ b/runtime/hprof/hprof.cc
@@ -671,8 +671,9 @@ class Hprof : public SingleRootVisitor {
okay = !file_output.Errors();
if (okay) {
- // Check for expected size.
- CHECK_EQ(file_output.SumLength(), overall_size);
+ // Check for expected size. Output is expected to be less-or-equal than first phase, see
+ // b/23521263.
+ DCHECK_LE(file_output.SumLength(), overall_size);
}
output_ = nullptr;
}
@@ -716,8 +717,8 @@ class Hprof : public SingleRootVisitor {
// Write the dump.
ProcessHeap(true);
- // Check for expected size.
- CHECK_EQ(net_output.SumLength(), overall_size + kChunkHeaderSize);
+ // Check for expected size. See DumpToFile for comment.
+ DCHECK_LE(net_output.SumLength(), overall_size + kChunkHeaderSize);
output_ = nullptr;
return true;