diff options
author | Jeff Hao <jeffhao@google.com> | 2015-05-12 18:58:32 -0700 |
---|---|---|
committer | Jeff Hao <jeffhao@google.com> | 2015-05-14 14:39:03 -0700 |
commit | c99b900283296663a37bffe06ae5ca6453748e16 (patch) | |
tree | b40b8880164b37bb8817d305152ae5e9ad151edd /runtime/hprof | |
parent | 3beb245da9392818e3154d47593f82cf0ef69aac (diff) | |
download | art-c99b900283296663a37bffe06ae5ca6453748e16.zip art-c99b900283296663a37bffe06ae5ca6453748e16.tar.gz art-c99b900283296663a37bffe06ae5ca6453748e16.tar.bz2 |
In hprof, set string class instance size to that of an empty string.
Bug: 21066704
Change-Id: Ic52193f5801117ca642055ea700fc4bc21b690e8
Diffstat (limited to 'runtime/hprof')
-rw-r--r-- | runtime/hprof/hprof.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc index d0eb083..868cb23 100644 --- a/runtime/hprof/hprof.cc +++ b/runtime/hprof/hprof.cc @@ -981,7 +981,11 @@ void Hprof::DumpHeapClass(mirror::Class* klass) { // ClassObjects have their static fields appended, so aren't all the same size. // But they're at least this size. __ AddU4(sizeof(mirror::Class)); // instance size - } else if (klass->IsArrayClass() || klass->IsStringClass() || klass->IsPrimitive()) { + } else if (klass->IsStringClass()) { + // Strings are variable length with character data at the end like arrays. + // This outputs the size of an empty string. + __ AddU4(sizeof(mirror::String)); + } else if (klass->IsArrayClass() || klass->IsPrimitive()) { __ AddU4(0); } else { __ AddU4(klass->GetObjectSize()); // instance size |